How to Make Sure All Box Buttons are Set to False Before BoxButtonWait
Keywords: boxbuttonwait
Question:
- I launch CD-ROM apps from a Button-based menu screen. Is there a way of insuring that all box buttons are set false before issuing the BoxButtonWait function. I want to insure that I am processing the current click and not a previous multiple click of the same button.
- It seems that BoxButtonStat only returns true if the left mouse button is clicked. Is there a way to check for right mouse clicks when hanging on the BoxButtonWait and BoxButtonStat functions.
Answer:
- Might want to TimeDelay(0.5) and then read all the button to clear them again. Trouble is that with any delay the user might be tempted to click them again. Or you could read them to clear them right before you are ready to accept new input.
- It returns TRUE when the button is clicked, either via keyboard or mouse. The right mouse button generally does not click buttons.
- Here is some code that I have used in the past to check for a multiple mouse click of a button or buttons.
First create the buttons.
:BUTTONS BOXBUTTONDRAW(1,2,"File","5,9,75,56") BOXBUTTONDRAW(1,1,"Design Data","75,9,215,56") BOXBUTTONDRAW(1,3,"Calculate","215,9,325,56") BOXBUTTONDRAW(1,8,"About","770,9,850,56") BOXBUTTONDRAW(1,9,"Help","850,9,920,56") BOXBUTTONDRAW(1,10,"Exit","920,9,995,56") GOTO BOXBUTTONWAIT2 ;Here I do not use boxbuttonwait, I just create a loop to ;keep reading the boxbuttonstat until a button has been choosen. ;Here you can also do a mouseinfo command. :BOXBUTTONWAIT2 if BoxButtonStat(1,1) then GOTO ENTERDESIGNDATA if BoxButtonStat(1,2) then GOTO FILE if BoxButtonStat(1,3) then GOTO CALCULATE if BoxButtonStat(1,8) then GOTO ABOUTPROG if BoxButtonStat(1,9) then GOTO HELP if BoxButtonStat(1,10) then GOTO EXITNOW GOTO BOXBUTTONWAIT2 ;After that I return to here to see if any other buttons have been ;clicked and clear that click if needed. Eventually it will return it self ;to the boxbuttonwait2 loop. :BOXBUTTONWAIT1 if BoxButtonStat(1,1) then GOTO BOXBUTTONWAIT1 if BoxButtonStat(1,2) then GOTO BOXBUTTONWAIT1 if BoxButtonStat(1,3) then GOTO BOXBUTTONWAIT1 if BoxButtonStat(1,8) then GOTO BOXBUTTONWAIT1 if BoxButtonStat(1,9) then GOTO BOXBUTTONWAIT1 if BoxButtonStat(1,10) then GOTO BOXBUTTONWAIT1 GOTO BOXBUTTONWAIT2
Article ID: W12757Filename: Checking Button Status before BoxButtonWait.txt