11-22-2022, 12:09 AM
(11-21-2022, 11:41 PM)bplus Wrote: Yes, I call this step:
While _MouseInput: Wend ' polling the mouse for current location for current loop
@SMcNeill not sure if you want to deal with this here and now but,
An issue that comes up with this is getting clear of last _MouseButton() so that you don't execute a Mouse click more than once for same click ie a little slow releasing the button.
As I recall you had a nice bit of code to resolve that issue.
The trick for this is really simple -- like so:
Code: (Select All)
oldmb = -1 'count as if the mouse is down to begin with
'this is so the mouse event has to have an UP then DOWN event to count as a click
Do
While _MouseInput: Wend
mb = _MouseButton(1)
If mb And Not oldmb Then
count = count + 1
Print "You just clicked the button! For a total of"; count
End If
oldmb = mb
_Limit 15
Loop Until _MouseButton(2) Or _KeyHit
Now this isn't going to process your mouse hold events (such as when you're going to do a click-and-drag), as it relies upon a complete UP-then-DOWN action to count as a mouseclick, but it makes certain that those clicks are processed once and only once, rather than anytime the mousebutton happens to be down.