I have it working in another program, but the program has a lot to it and I can't figure out how I got it to work. I tried to create this simple program to figure it out. So far not working.
I would like to avoid using gadget event binding as I somehow did in my other program. The Ok button is still not working in my other program either, but the 8 buttons in it are showing the state
What am I missing?
Code: Select all
If OpenWindow(0,0,0,300,200,"Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ButtonGadget(1,10,10,25,25,"1",#PB_Button_Toggle)
ButtonGadget(2,40,10,25,25,"2",#PB_Button_Toggle)
ButtonGadget(3,70,10,25,25,"3",#PB_Button_Toggle)
ButtonGadget(4,100,10,25,25,"4",#PB_Button_Toggle)
ButtonGadget(5,120,50,25,25,"Ok")
Repeat
event=WaitWindowEvent()
Bgadget=0
Select EventID
Case #PB_Event_Gadget
Select GadgetID
Case 1
If EventGadget()
Bgadget=GetGadgetState(1)
Debug "Btn 1 "+Bgadget
EndIf
Case 2
If EventGadget()
Bgadget=GetGadgetState(2)
Debug "Btn 2 "+Bgadget
EndIf
Case 3
If EventGadget()
Bgadget=GetGadgetState(3)
Debug "Btn 3 "+Bgadget
EndIf
Case 4
If EventGadget()
Bgadget=GetGadgetState(4)
Debug "Btn 4 "+Bgadget
EndIf
Case 5
If EventGadget()
Bgadget=GetGadgetState(4)
Debug "Btn Ok "+Bgadget
EndIf
EndSelect
EndSelect
Until event=#PB_Event_CloseWindow
CloseWindow(0)
EndIf