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

Started by Damian on 8-Jun-2012/1:07:16-7:00
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
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]]
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]]
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.

Reply

Replies are rate limited to reduce abuse.