[Gambas-user] simplify code with picture
Fabien TONIUTTI
fabien.toniutti at free.fr
Sun Nov 12 20:15:17 CET 2023
Hello,
I have one button with one picture who look like a LED on and off
I have on boolean variable in my code named myvar.
I could write this code :
Public Sub button1_Click()
myvar = Not myvar
Select Case myvar
Case False
Button1.Picture = Picture[ledOFF]
Case True
Button1.Picture = Picture[ledON]
End Select
End
Is existing on faster solution as this example bellow: (i didn't try it) :
button1.Picture = myvar AND Picture[ledON]
Thanks for your answer.
More information about the User
mailing list