Button needs 2 clicks?
Posted: Sun Sep 27, 2009 4:34 pm
When I run this code and click on the button the first time nothing happens..? But when I click on it the 2nd time the pop up window works and then every time I click on it after that, it works. Until I close the program and open it up again. Why is this?
Code: Select all
If OpenWindow(0, 0, 0, 230, 90, "Event handling example...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget(0, 10, 10, 280, 20, "I am a window")
ButtonGadget (2, 10, 40, 200, 20, "Check me")
Repeat
event = WaitWindowEvent() : #PB_Event_Gadget
If event = #WM_LBUTTONDOWN And EventGadget() = 2
MessageRequester("Pop up Win", "HELLO WORLD!")
;Debug event
EndIf
Until event = #PB_Event_CloseWindow
EndIf
End