In my version you don't need to click things twice. And I added white lines. You *need* white lines as much as you need indenting. Having no white lines is like reading a line of text which has no commas.
Remember this line: You only need a Waitevent() command once, in your main loop from which you call all your functions.
You don't need it in any other fuctions, unless they're self-contained popup things like a color chooser, but you're far from that stage at this moment.
So, you had Select Waitevent() in your functions, that was the cause of your double-click bug, why check again for events? You'd already done so in your mainloop. The waitevent() command doesn't need to be anywhere in your functions because it's not relevant having it there. Waitevent waits for an event, once that event has occured, some global variables are filled, these global variables are (actually they're presented as functions, but nevermind) EventSource(), EventID(), EventX(), EventY(), EventData() and perhaps some more, dunno, read the manual I'd say. :P
So, once they've been filled you can just read them out in any function, no need for extra WaitEvent commands.
Here's an improved version, regarding functionality and readability.
Remember this line: You only need a Waitevent() command once, in your main loop from which you call all your functions.
You don't need it in any other fuctions, unless they're self-contained popup things like a color chooser, but you're far from that stage at this moment.
So, you had Select Waitevent() in your functions, that was the cause of your double-click bug, why check again for events? You'd already done so in your mainloop. The waitevent() command doesn't need to be anywhere in your functions because it's not relevant having it there. Waitevent waits for an event, once that event has occured, some global variables are filled, these global variables are (actually they're presented as functions, but nevermind) EventSource(), EventID(), EventX(), EventY(), EventData() and perhaps some more, dunno, read the manual I'd say. :P
So, once they've been filled you can just read them out in any function, no need for extra WaitEvent commands.
Here's an improved version, regarding functionality and readability.
;Event List KEY_DOWN=$101 ;A key was pressed down-needs the keys scancode for EventData(). KEY_UP=$102 ;A key has been released on the keyboard-needs the keys scancode for EventData(). KEY_USED=$103 ;A key has been typed-needs keys ascii value. MOUSE_BUTTON_DOWN=$201 ;self explanatory, needs one of the following values(1=left,2=middle,3=right). MOUSE_OVER_CANVAS=$203 ;self explanatory, you need to use EventX() and EventY() along with the canvas handle. GADGET_USED=$401 ;self explanatory, you need to be specific to what kind of gadget it is, and what the gadgets handle is as well. MENU_SELECTED=$1001 ;something has been selected from a menu, needs the menu identifier X_HIT=$803 ;The X was hit APPLICATION_HALTED=$2001 ;Self explanatory, means that the program was suspended APPLICATION_RESUMED=$2002 ;Self explanatory, means that the program was resumed window=CreateWindow("UNTILTLED TEST",300,300,400,400,window,15) uno=CreateButton("1",35,35,35,35,window,1) dos=CreateButton("2",70,70,70,70,window,1) menu=WindowMenu(window) file=CreateMenu("File",1,menu) finish=CreateMenu("End",2,file) UpdateWindowMenu(window) guibank=CreateBank(120) PokeInt guibank,0,window PokeInt guibank,4,uno PokeInt guibank,8,dos PokeInt guibank,12,file PokeInt guibank,16,finish Repeat WaitEvent() ; <- fixed Buttonz guibank Until EventID()=$803 ; <- fixed Notify("Ending...") End Function Buttonz(guibank) window=PeekInt(guibank,0) uno=PeekInt(guibank,4) dos=PeekInt(guibank,8) Select EventID() ; <- fixed Case $401 If EventSource()=uno Then ; fixed some here and below Notify "UNO" ElseIf EventSource()=dos Then Notify "DOS" EndIf End Select End Function Function Menuz(guibank) file=PeekInt(guibank,12) finish=PeekInt(guibank,16) Select EventID() ; <- fixed Case $1001 If EventSource()=finish Then Notify("See ya!") Delay 500 End EndIf End Select End Function