-->
Page 1 of 3

Toggle image button

PostPosted: Mon May 30, 2016 8:34 pm
by Mmiscool
This will work with version 3.0 xx

Images used are attached but you may want to make them phancier.

Will Make an image button that can be toggled.
Code: Select all'Toggling Image button example
io(po,D4,0)
[TOP]
CLS

if io(laststat,D4) = 1 then
IMAGEBUTTON "ON.PNG", [ON]
else
IMAGEBUTTON "OFF.PNG", [OFF]
end if
wait


[ON]
io(po,D4,0)
goto [TOP]

[OFF]
io(po,D4,1)
goto [TOP]

Re: Toggle image button

PostPosted: Tue May 31, 2016 6:04 am
by viscomjim
Does this toggle the output pin also, or just the image?

Re: Toggle image button

PostPosted: Tue May 31, 2016 6:28 am
by Mmiscool
It toggles both.

Re: Toggle image button

PostPosted: Tue May 31, 2016 11:25 am
by viscomjim
Sorry, I didn't see the on and off branches below the main code.

Great work!!! Thanks!