(Obviously, this is just a *personal preference* thing but I think this is nicer)
Code: Select all
Repeat
EVENT=WaitWindowEvent()
Select EVENT
Case #PB_EventGadget
;- PB Gadget Events
Select EventGadgetId()
Case #BTN_1: Debug(str(#BTN_1)
Case #BTN_2: Debug (str(#BTN_2)
EndSelect
Case #PB_EventMenu
;- PB Menu Events
Select EventMenuId()
Case #MENU_1:
Case #MENU_1:
EndSelect
EndSelect
Instead of the explosion of If ElseIf's (which I find difficult to read):
Code: Select all
Repeat
Event = WaitWindowEvent()
Case
Select
If Event = #PB_EventMenu
;Debug "WindowID: " + Str(EventWindowID())
MenuID = EventMenuID()
If MenuID = #MENU_1
Debug "GadgetID: #MENU_1"
ElseIf MenuID = #MENU_5
Debug "GadgetID: #MENU_5"