[Gambas-user] How to change a picture when a key is pressed ?
Matti
math.eber at ...221...
Fri Jan 8 21:28:49 CET 2010
I also don't have the original message, but PictureBox_KeyPress() works fine here.
Try something like:
PUBLIC SUB PictureBox1_KeyPress()
IF Key.Code = 4096 THEN PictureBox1.Visible = FALSE
END
(this Key.Code is "ESC". Look in the docs for "Key".)
Or, if you need it, something with left/right mouse:
PUBLIC SUB PictureBox1_MouseDown()
IF Mouse.Left = TRUE THEN
PictureBox1.Visible = FALSE
ELSE
mnuGross.Popup
ENDIF
END
Hope this helps.
Matti
charlesg schrieb:
> 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