Bottlenecking of clicks due to the "wait" command
Posted: Thu Mar 20, 2008 6:01 am
Hi there, I have a problem that has to do with using the "wait" and possibly "disable" functions on a button. What I want to happen is the following:
User clicks on a button initially labeled "A" which, when pressed, changes in backgroundcolor for a second while displaying a certain number (coming from a variable called Risk here). After a second of displaying the number+color I want the button color to go back to normal grey and then the button to be unclickable for a second. After this the button should be re-enabled with the number again replaced by the letter A. This whole process is just so people notice that discrete trials are occurs, since on some occassions the same number will be prodcued, e.g., 3 3 3 3 and I want users to know that the number is actually being re-calculated each time they click, it just happens to be the same as before.
The code I have used is:
on mouseDown
add 1 to ButtonCnt
set the label of me to item 1 of line ButtonCnt of Risk
set the backgroundcolor of me to "117,170,249"
wait 1 seconds
set the backgroundcolor of me to "228,228,228"
end mouseDown
on mouseUp
disable me
wait for 1 seconds
set the label of me to A
enable me
end mouseUp
This seems to do the job, up until users start madly clicking during the "wait" and "disabled" times. These clicks are all recorded by the program and build up and sort of go crazy...
Is there some way to disable the registering of mouse clicks during the time between the initial click and the time the button become re-enabled?
Thanks for any help,
Adrian
User clicks on a button initially labeled "A" which, when pressed, changes in backgroundcolor for a second while displaying a certain number (coming from a variable called Risk here). After a second of displaying the number+color I want the button color to go back to normal grey and then the button to be unclickable for a second. After this the button should be re-enabled with the number again replaced by the letter A. This whole process is just so people notice that discrete trials are occurs, since on some occassions the same number will be prodcued, e.g., 3 3 3 3 and I want users to know that the number is actually being re-calculated each time they click, it just happens to be the same as before.
The code I have used is:
on mouseDown
add 1 to ButtonCnt
set the label of me to item 1 of line ButtonCnt of Risk
set the backgroundcolor of me to "117,170,249"
wait 1 seconds
set the backgroundcolor of me to "228,228,228"
end mouseDown
on mouseUp
disable me
wait for 1 seconds
set the label of me to A
enable me
end mouseUp
This seems to do the job, up until users start madly clicking during the "wait" and "disabled" times. These clicks are all recorded by the program and build up and sort of go crazy...
Is there some way to disable the registering of mouse clicks during the time between the initial click and the time the button become re-enabled?
Thanks for any help,
Adrian