[REBOL] Re: MAPLETS: Rollovers, Matrices, Smart-Maps and Reblets [long newbie qu
From: carl:cybercraft at: 7-Sep-2001 10:41
On 07-Sep-01, Jason Cunliffe wrote:
> Greetings
> I posted clumsily before without reply. Not sure which forum is best
> for this kind of discussion. I been exploring REBOL for a few days
> only.. its wonderful :-)
> Q1: How do I do a simple mouse rollover [no clicking] to change the
> image displayed to another image provided by a list/dictionary
> function. Is there any sample code for handling UP OVER DOWN HIT
> type button parameters?
Okay, I'll have a shot at this, but beware, this is my first attempt
at rollovers. (:
My starting-point for this was the Feel/Events tutorial in the REBOL
website's HowTo section. Have a look at it if you've not seen it.
Hope the following helps...
rebol []
; Create 4 images within a block. I'm not quite sure what you mean by
list/dictionary, but this is at least a list...
pics: reduce [
to-image layout [backdrop blue text "Pic 1"]
to-image layout [backdrop white text "Pic 2"]
to-image layout [backdrop green text "Pic 3"]
to-image layout [backdrop yellow text "Pic 4"]
]
; This is the function that changes the image.
roll: func [face act pointer][
face/image: either act = true [
first skip pics pointer
][
first skip pics pointer - 1
]
show face
]
; And here's the layout with two rollovers in.
view layout [
roll1: image pics/1 feel [over: func [face act][
roll face act 1
]]
roll3: image pics/3 feel [over: func [face act][
roll face act 3
]]
]
--
Carl Read