Home   Archive   Permalink



Can't make 'Show' re-display my screen

Can't make 'Show' re-display my screen
    
I am trying to display a new set of images after the user presses a button. The first part of the script sets a count, assigns the file path to the images to be displayed (which is done randomly within a set of options) and draws the window. This happens as expected the first time around. The button in question calls a function that re-assigns the images and then requests to show the new set of images. I know that the assignment is done properly but the window is not updated. What am I missing?
    
This is the code in question:
    
view gui: layout [
    
     backdrop white
     text font-size 15 "Set of pictures”
     below
     text join "Photo's clicked: " count
     across
     button 148x135 my-pict1 [ count: count + 1 ]
     button 148x135 my-pict2 [ count: count + 1 ]
     return
     across
     button 148x135 my-pict3 [ count: count + 1 ]
     button 148x135 my-pict4 [ count: count + 1 ]
     return
     btn 148 "New set" [ set-new-picts show gui ]
]
    
I have also tried naming the buttons (e.g. a: button 148x135 my-pict1 [ count: count + 1 ]) and then calling:
     show [a b c d]
    
and even trying:
     show a show b show c show d
    
options that I collected from reading the documentation, but to no effect.
    
I appreciate any insight and/ or solutions

posted by:   Damian       8-Jun-2012/1:07:16-7:00



I think you do something like that:
    
my-pic: load %file.png
view gui: layout [button my-pic]
    
than you are changin the my-pic;
my-pic: load %another-file.png
show gui
    
but actually you didn't change the image of your button. you my-pic word are not connected to your button's picture. You should change the picture of your button:
    
my-pic: load %file.png
view gui: layout [b: button my-pic]
;...
b/image: load %another-file.png
show b
    
this will change your button's picture.
    
    
Here is another example, it loads & shows a random picture from the current path: (before run this, go to a path which holds a number of pictures)
    
view layout [image 100x100 "Click Me!" [face/image: load-image probe random/only read %./ show face]]
    


posted by:   Endo       11-Jun-2012/5:05:34-7:00



Solution is very simple, you should act on image refinement, look at this example:
view layout [ a: button stop.gif [a/image: logo.gif show a]]
    
and if you want to learn more, try:
view layout [ a: button stop.gif [? a]]

posted by:   MaxV       26-Jul-2012/9:33:35-7:00



Thank you Endo, your recommendations worked just fine.
    
And thank you MaxV, your explanation was very concise and helpful. Your last example was also very illustrative.

posted by:   Damian       26-Aug-2012/15:54-7:00