Rollover effect
[1/5] from: belkasri:1stlegal at: 19-Jun-2002 14:54
This should be easy for you guys!
I wrote these line to have a rollover effect, when the mouse is over a
button an image is suppose to switch its content:
city-rio: http://www.struhscompany.com/tmp/rio.jpg
city-paris: http://www.struhscompany.com/tmp/paris.jpg
view layout [
city: image city-rio
button "Rio" feel [
over: func [face act pos] [
face/text: either act ["Paris"]["Rio"]
city/image: either act [ city-paris ][ city-paris ]
show city
show face
]
]
]
instead the image disapear, what I am doing wrong?
--Abdel.
[2/5] from: greggirwin:mindspring at: 19-Jun-2002 14:43
Hi Abdel,
<< I wrote these line to have a rollover effect, when the mouse is over a
button an image is suppose to switch its content:
...
instead the image disapear, what I am doing wrong? >>
You need to LOAD the image when you change it. Layout does it for you when
you specify the url originally, but not when you change it. If you don't
load it, you're assigning the url to city/image.
city-rio: http://www.struhscompany.com/tmp/rio.jpg
city-paris: http://www.struhscompany.com/tmp/paris.jpg
view layout [
city: image city-rio
button "Rio" feel [
over: func [face act pos] [
face/text: either act ["Paris"]["Rio"]
city/image: load either act [ city-paris ][ city-rio ]
show city
show face
]
]
]
--Gregg
[3/5] from: nitsch-lists:netcologne at: 19-Jun-2002 22:53
Hi Abdel,
Am Mittwoch, 19. Juni 2002 21:54 schrieb Abdel Belkasri:
> This should be easy for you guys!
> I wrote these line to have a rollover effect, when the mouse is over a
<<quoted lines omitted: 13>>
> ]
> instead the image disapear, what I am doing wrong?
city-rio: LOAD http://www.struhscompany.com/tmp/rio.jpg
city-paris: LOAD http://www.struhscompany.com/tmp/paris.jpg
view layout [
city: image city-rio
button "Rio" feel [
over: func [face act pos] [
face/text: either act ["Paris"]["Rio"]
city/image: either act [ city-paris ][ city-rio ]
show city
show face
]
]
]
layout loads image if you give an url.
but if you change a face/image like
city/image: either act [ city-paris ][ city-rio ]
by hand, you have to give an image.
> --Abdel.
-Volker
[4/5] from: greggirwin:mindspring at: 20-Jun-2002 10:54
Hi Abdel,
Use Volkers method to load the images just once. I don't know what *I* was
thinking. :) the only time you might want to load on demand is if you had a
lot of image that might eat up memory. Also, loading from a local file is
very fast, but over a url is not.
--Gregg
[5/5] from: jason::cunliffe::verizon::net at: 19-Jun-2002 22:06
Q1: How to make the button text also change on rollover?
Q2: How do you suggest to wrap the rollover into a widely reusable function for
View?
thanks
./Jason
==================================================================
REBOL []
{Rollover from rebol-list 19-June-2002}
city-rio: LOAD http://www.struhscompany.com/tmp/rio.jpg
city-paris: LOAD http://www.struhscompany.com/tmp/paris.jpg
view layout [
city: image city-rio
button "Rio" feel [
over: func [face act pos] [
face/text: either act ["Paris"]["Rio"]
city/image: either act [ city-paris ][ city-rio ]
show city
show face
]
]
button "quit" red [unview/all]
]
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted