12-06-2022, 02:28 AM
(12-06-2022, 01:39 AM)OldMoses Wrote:(11-22-2022, 02:00 AM)SMcNeill Wrote: @Pete If you're going that complex, use MBS: https://staging.qb64phoenix.com/showthread.php?tid=138
MBS pretty much does everything I need a mouse to do, and more that I haven't quite figured out yet. I haven't done any "hold and release" type stuff.
Once I've grabbed a mouse button event, the very first step in processing it is to clear the buffer with:
Code: (Select All)SUB Clear_MB (var AS INTEGER)
DO UNTIL NOT _MOUSEBUTTON(var)
WHILE _MOUSEINPUT: WEND
LOOP
END SUB 'Clear_MB
A bit loopy for a solution, but so far, I've had no more click through events.
Oh I've made mouse routines far more complex than that one. That's why I labeled it as, "mini_mouse".
One thing you might want to consider is...
Code: (Select All)
DO
_LIMIT 30
WHILE _MOUSEINPUT: WEND
IF _MOUSEBUTTON(1) THEN
Clear_MB var
BEEP ' It will only beep when mouse button is released.
END IF
LOOP
SUB Clear_MB (var AS INTEGER)
DO: _LIMIT 5: WHILE _MOUSEINPUT: WEND: LOOP UNTIL NOT _MOUSEBUTTON(1)
END SUB
If I run it without _LIMIT in the SUB my CPU jumps from 6% to 52%. With _LIMIT it idles at 4%. I mean this will only happen if your cat decides to sit on your mouse. Yes, I have a cat... and yes, it sits wherever the hell it wants!
What you use is what I also use when the apps are not very involved. Much faster to type it out and get things running.
Pete
If eggs are brain food, Biden takes his scrambled.