Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Clearing the mouse queue?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
a_ndy




PostPosted: Mon Jul 19, 2004 8:13 pm   Post subject: Clearing the mouse queue?

I was wondering if there was a way to clear the mouse queue...

I know Turing's help index says Mouse.ButtonWait checks if there is an appropriate event (a click) in the queue... however, if I have a section of program where actions are prompted by consecutive mouse clicking and someone does some mad clicking right at the beginning, the program will skip right through all those actions in the blink of an eye because all those clicks are queued up.

So then, back to the question... is there a way to clear the queue after each action so that the next action requires a new click instead of just the ones queued up way back when?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Jul 19, 2004 10:20 pm   Post subject: (No subject)

shouldn't a delay before each check allow the system to process the extra clicks?

if not, don't use .ButtonWait. Use .MouseWhere and check for the click yourself rether then having the system wait for one.

the flush function would probably look something like
code:

var x,y,b:int

proc flushMouse()
loop
Mouse.Where(x,y,b)
exit when b=0
end loop
end flushMouse
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
DanShadow




PostPosted: Mon Jul 26, 2004 6:39 pm   Post subject: (No subject)

Yep, that works. I also used something similar to that when I was helping a friend out on his ISU. He was making checkers, and to judge where he was moving the piece, he had to use a code similar to that, and when he let go of the mouse button (b=0) then it would exit the loop, and place the piece accordingly, if it were in an acceptable place. So basically include the rest of your programs code inside a mini program..ie the one tony showed you.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: