Thanks to (in order of receipt of postings), Andrew, Gabriele, Carl and Anton
for the extremely helpful responses.
One quick other question. In Carl's code (repeated below for easy of
reference), the initially blue die is always on top of the initially red one.
I'd like to change that.
I'd like the item I'm dragging to be at the top. Do I have to re-order the
faces in the layout and then show the whole thing? Or is there a cleverer way
to change z-plane priorities?
Thanks,
Sunanda.
;; Carl's code:
; This function just makes an image from a layout...
make-die: func [color [tuple!] /local image][
layout [
image: box 30x30 effect [draw [
pen none
fill-pen color none
circle 14x14 15
]]
]
to-image image
]
Board-elements: Stylize [
black-square: box 100.100.100 50x50
white-square: box white 50x50
; 'die is now an image - note the 'key effect used
; to make the black in the image transparent.
die: image make-die red effect [key 0.0.0]
]
unview/all
view layout [
styles board-elements
space 0x0
across
black-square
white-square
black-square
return
white-square
black-square
white-square
return
black-square
white-square
black-square
return
; The 'feels here are just a copy of the drag & drop
; example from the 'feel how-to example on the REBOL
; site. Your dice can now be picked up and moved...
d1: die feel [engage: func [face action event] [
if action = 'down [start: event/offset]
if find [over away] action [
face/offset: face/offset + event/offset - start
show face
]
]]
d2: die feel [engage: func [face action event] [
if action = 'down [start: event/offset]
if find [over away] action [
face/offset: face/offset + event/offset - start
show face
]
]]
; Set original colors...
do [
d1/image: make-die red
d2/image: make-die blue
]
; Button for user-defined color. (;
button "Change" [
d1/image: make-die random 255.255.255
show d1
]
]
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.