Page 1 of 1

Bottlenecking of clicks due to the "wait" command

Posted: Thu Mar 20, 2008 6:01 am
by ac11ca
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

Keyboard buffer

Posted: Thu Mar 20, 2008 7:38 am
by bjb007
This is just a clue, perhaps, but back in
the days of DOS there was a function to
clear the keyboard buffer so that extra
clicks weren't sent to a prog.

Perhaps someone more up-to-date on
this than I am will come to the rescue.

Posted: Thu Mar 20, 2008 10:59 am
by Mark
Hi Adrian,

Why do you want this? Normally, if a user sees a number change, or a colour in this case, s/he's understand that the click has had its effect and there's no need for another click. If the user clicks anyway, there's nothing you can do about it. So, changing colour should be sufficient and there shouldn't be a reason to disable the button --even less to disable it for only second.

The problem here is, you're waiting with the button enabled, which means that any mouseClicks during that time are handled.


If you want it anyway, this might help:

Code: Select all

on mouseDown
  if the backColor of me is "117,170,249" then
    beep
  else
    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 sec with messages
    set the backgroundcolor of me to "228,228,228" 
  end if
end mouseDown
Make sure that the cantAbout of your stack is true while you excute this script.

Best,

Mark

Posted: Sun Mar 23, 2008 1:48 am
by ac11ca
Hi Mark,

I wanted this piece of coding because many of my users will be largely unmotivated and will likely try to 'click through' to the end of the sequence without paying much attention to the text coming up on the buttons.

I appreciate the coding you gave me, it seems to have done the trick and works quite well. The annoying beep sound is definately aversive enough to get users to slow down, I think :)

Cheers,
Adrian.