Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Counter measures

From: carl:cybercraft at: 6-Sep-2002 10:14

On 06-Sep-02, [SunandaDH--aol--com] wrote:
> 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
And complete even unto the typed-in-the-wrong window "unview/all". (:
>), 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.
Gabriele's {You need to swap the two faces in the pane block. The faces on a higher position are shown on top of those placed "before" them.} is probably the way to do this, but I for one would like to see an example - as my attempt at doing it doesn't work. (: Carl.
> ;; 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 > ] > ]
-- Carl Read