[Gambas-user] simplify code with picture
T Lee Davidson
t.lee.davidson at gmail.com
Mon Nov 13 16:28:08 CET 2023
On 11/12/23 14:35, Jussi Lahtinen wrote:
> Simpler or faster? Anyway, I don't see much point on either. It is already fast for GUI purposes and very simple.
> However, here:
>
> Button1.Picture = IIf(Button1.Picture = hLEDON, hLEDOFF, hLEDON)
>
> Assuming you have the pictures declared this way:
> Private hLEDON As Picture = Picture[ledON]
> ...
>
> Jussi
Yes.
Or, do away with the 'myvar' semaphore and simply use a ToggleButton:
ToggleButton1.Picture = IIf(ToggleButton1.Value, hLEDON, hLEDOFF)
--
Lee
More information about the User
mailing list