Button Timing Problem (I think)

Len Morgan len-morgan at crcom.net
Fri Feb 29 12:41:06 EST 2008


I'm having a little trouble with a dialog box.  To be completely 
accurate, my users are having the problem.  I can't seem to reproduce it.

What I do is put up a dialog box (from a separate stack) which has the 
"next ID #" in a field.  This number comes from a sequence in the 
database (since there could be multiple users doing this at the same 
time).  When the OK button is checked I do the following:

1) See if the field has the same number as I put up. (They might want to 
change the number for various reasons.)
2) If they have selected a different number than the one the database 
had, I reset the database to put the "next ID #" back
3) At this point, I have the number they want to use.
4) I now check the database to see if we already have that number.  If 
we don't I do some housekeeping then add the inmate.
5) If I already DO have that number, I put up an error message and exit.

The problem I'm having is that sometimes the number gets doubled (i.e., 
two database records).  What I suspect is happening is that the button 
is being pressed again (or at least Rev interprets it that way), between 
the time I check to see if it's already there and actually inserting the 
record into the database.

All of that is to set up my questions:

1) Does a double click send a mouseDoubleUp AND a mouseUp message (for 
the first of the two clicks)?
2) Can I somehow disable the button fast enough to prevent a double click?

As I said, I can't seem to make this happen on my machine but my users 
seem to be quite good at it.  It also doesn't happen every time and 
seems to be isolated to one or two users.

Any thoughts?

len morgan



More information about the use-livecode mailing list