[Gambas-user] How to change a picture when a key is pressed ?

Bill Richman bill at ...2351...
Fri Jan 8 16:10:24 CET 2010


I don't see the original post of this question, but when I was trying to 
do something like this, I ended up using a "ToolButton".  You can assign 
pictures to them and change them using the same 
"Picture.Load(mypicture.jpg)" command.  They generate "ToolButton_click" 
events.  The ToolButton is (at least in my world) on the Form tab, 
between the "Toggle Button" and the "Slider" controls, shown as a button 
with a small picture of the GAMBAS logo on it.  Hope this helps.

Bill Richman - Lincoln, Nebraska
Tilter at windmills, maker of pies in the sky, & curmudgeon
email: bill at ...2350...  web: www.geektrap.com




charlesg wrote:
> Hi
>
> I don't mess around with pictures much so this may be the blind leading the
> blind.
>
> The command is: PictureBox1.Picture =
> Picture.Load("/home/charles/Photos/SV400005.JPG")
>
> I could not get a response to a PictureBox1_keypress event so I buried a
> textbox behind the picturebox, made sure it had focus and:
>
>
>   
>> PUBLIC SUB TextBox1_KeyPress()
>>   IF Key.text = "a" THEN 
>>     PictureBox1.Picture =
>> Picture.Load("/home/charles/Photos/SV400005.JPG")
>>   ENDIF 
>> END
>>
>>     
> Remember that Key.text is case sensitive so you should test for that.
>
> rgds
>   



More information about the User mailing list