I'm having Trouble with Toggle images ?
https://vmars.us/ShowMe/WorkingButton- ... -\bmp.bmp
https://vmars.us/ShowMe/StartButton-Gr ... 2-bmp.bmp
See code below:
Problem is that code doesn't show either image .
Code: Select all
; www.purebasic.com
; Author: Andre Beer (PureBasic-Team - www.purebasic.com) (updated for PB4.00 by blbltheworm)
; Date: 4. May 2003
; OS: Windows
; Demo: Yes
; TOGGLE-2-Images.pb -Millie78526
Image1 = LoadImage(0,"StartButton-Green-159x42-bmp.bmp")
Image2 = LoadImage(1,"WorkingButton-Red-159x42-bmp.bmp")
If OpenWindow(0, 10, 100, 320,180, "ButtonImageGadget & SetGadgetState", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
; ButtonImageGadget(0,10,10,291,155,ImageID)
ButtonImageGadget(0,10,10,159,42,ImageID)
Repeat
Debug "Repeat"
EventID.l = WaitWindowEvent()
If EventID = #PB_Event_Gadget
gad.l = EventGadget()
If gad = 0
If ImageID = Image1
ImageID = Image2
Else
ImageID = Image1
EndIf
SetGadgetState(0,ImageID)
; Delay(2000)
EndIf
EndIf
If EventID = #PB_Event_CloseWindow
Quit = 1
EndIf
Until Quit = 1
EndIf
End