Getting variable output twice after Select Case Menu
Posted: Wed Sep 18, 2019 11:52 am
Hello,
I have the following simple menu to call a procedure:
The output of the debug command is
The problem is I simply don't understand why I get a doubled output for variable x. So far, I've found out that is apparently has something to do with the case menu selection
Can someone enlighten me? I am running v5.70. Thanks!
I have the following simple menu to call a procedure:
Code: Select all
Enumeration
#MAIN_WINDOW
#MAIN_BUTTON_EXIT
#MAIN_BUTTON_0
#FLAGS = #PB_Window_SystemMenu | #PB_Window_ScreenCentered
EndEnumeration
Procedure Button_0()
x = 1
Debug x
EndProcedure
Procedure MainWindow()
OpenWindow(#MAIN_WINDOW, 0, 0, 300, 200, "Main Window", #FLAGS)
ButtonGadget(#MAIN_BUTTON_EXIT,230,180,70,20,"Quit")
ButtonGadget(#MAIN_BUTTON_0,60,80,175,40,"Run Procedure with Button_0")
Repeat ; main program loop
MainWindowLoop = WindowEvent()
Select EventGadget() ; this is apparently needed to make the button do stuff!
Case #MAIN_BUTTON_0
Button_0()
Case #MAIN_BUTTON_EXIT
Quit = #True
EndSelect
Until MainWindowLoop = #PB_Event_CloseWindow Or Quit = #True
EndProcedure
MainWindow()
Code: Select all
1
1
Can someone enlighten me? I am running v5.70. Thanks!