WaitWindowEvent()
Syntax
Event = WaitWindowEvent()Description
Wait until an event occurs. It's the same function than WindowEvent() but locks the program execution, which is very important in multitasking environment. An application should always use this command instead of WindowEvent() if possible. For more information, see the documentation of WindowEvent().
Basic example:If OpenWindow(0,0,0,230,90,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Event handling example...") If CreateGadgetList(WindowID()) ButtonGadget (1, 10, 10,200, 20, "Click me") CheckBoxGadget(2, 10, 40,200, 20, "Check me") EndIf If CreateMenu(0, WindowID()) MenuTitle("Menu") MenuItem(1, "Item 1") MenuItem(2, "Item 2") MenuItem(3, "Item 3") EndIf Repeat EventID = WaitWindowEvent() Select EventID Case #PB_Event_Gadget Select EventGadgetID() Case 1 : Debug "Button 1 clicked!" Case 2 : Debug "Button 2 clicked!" Case 3 : Debug "Button 3 clicked!" EndSelect Case #PB_Event_Menu Select EventMenuID() Case 1 : Debug "Menu item 1 clicked!" Case 2 : Debug "Menu item 2 clicked!" Case 3 : Debug "Menu item 3 clicked!" EndSelect EndSelect Until EventID = #PB_Event_CloseWindow EndIf
Supported OS
All