On Wed, 16 Aug 2017, Doug Hutcheson wrote: > Thanks for the explanation, Tobias. Having fixed the declaration, I am > able to run the code, but all I see is an empty form with no controls. > Sigh. I will keep hacking until I understand enough to make it work. >
In case you don't want to figure it out on your own (although you didn't ask), this is most likely because the code uses the Picture[] cache. It accesses Picture["imgSwtchOn.png"] and Picture["imgSwtchOff.png"], but you probably don't have those files in your application (you don't unless you added them on your own). Since Picture[] is the picture cache, it won't raise an error if the named pictures aren't found and returns a silent Null instead. Assigning Null to a PictureBox.Picture clears the PictureBox. This is why you don't see anything. Actually this example is horrible. Not only uses it resources which aren't available by default, it also relies on the geometry of the PictureBoxes and Mouse coordinates to identify which PictureBox raised the event, instead of simply using Last. And then it needlessly uses Object instead of PictureBox, and uses a *bitmask* to store the on/off state of the pictures instead of just the PictureBox's Tag property. Not to mention it isn't indented properly. There is a high density of things I would advise to avoid here. Why did you choose this of all to learn from? :-) I updated the example and it should work out of the box now. Regards, Tobi -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user