[REBOL] Switching images
From: rossandruth:xtra at: 12-May-2001 1:20
Hello,
I am new to this list and new to REBOL. I got into REBOL by needing to make
some changes to a script at my workplace. The changes were substantial,
required an upgrade of REBOL/Core, worked mostly first try, and I am now
hooked on REBOL. :-)
Anyway, looking at REBOL/View, I have started a small project so I can say I
have written something from scratch, that is useful, and works.
The aim is to load some images (all the same size) off the net or somewhere,
and display them in turn using controls to show the next, previous, first,
last, play as a loop, adjust looping speed, delays and so on.
Here is a try... it does not work; just shows a blank image face, and the
controls buttons.
(Comments and questions are below.)
;====================
REBOL []
images: [ %/c/ensemble/500hPa_height/m500z_f000_shbg_20010504.gif
%/c/ensemble/500hPa_height/m500z_f024_shbg_20010504.gif
%/c/ensemble/500hPa_height/m500z_f048_shbg_20010504.gif
%/c/ensemble/500hPa_height/m500z_f072_shbg_20010504.gif
%/c/ensemble/500hPa_height/m500z_f096_shbg_20010504.gif
%/c/ensemble/500hPa_height/m500z_f120_shbg_20010504.gif
]
view layout [
vh2 "Looper"
theimage: image [images first] 300x350
across
button "Prev" [theimage/image: [images back] show theimage]
button "Next" [theimage/image: [images next] show theimage]
button "Quit" [quit]
return
name: text "Merlot" 100x30
button "Change" [name/text: "Cabernet" show name]
]
;===========================
1) In <theimage: image [images first] 300x350>, if <[images first]> is
replaced by <images/1>, the first image is displayed. YeeHa!
But, what's wrong with <images first>?
2) The two lines
name: text "Merlot" 100x30
button "Change" [name/text: "Cabernet" show name]
are to show that this general technique of using a button action to change
the content of a face does work (as suggested in the REBOL/View
documentation HTML page).
That being the case, what is wrong with the lines
button "Prev" [theimage/image: [images back] show theimage]
button "Next" [theimage/image: [images next] show theimage]
3) I also tried a placing the button actions in functions like
previmage: does [theimage/image: [images back] show theimage]
but that does not work either. The functions would eventually check
for the current image being the first or last and do something sensible.
4) What about <button "Quit" [quit]>? What is the command to close the
REBOL/View child window created by <view layout [faces]> but leave
the REBOL/View console and or Desktop running.
Is there a command that can be issued from the console to kill a
REVOL/View app window? This is when the script has stalled, and the
window controls are patchy... the [X] does nothing, but [_] minimises
the window. (We are on Win95, here.)
Thanks in advance... Sorry about the length for a first post :-[
Ross Marsden
Wellington, NZ