10-30-2025, 05:53 AM
https://qb64phoenix.com/forum/showthread.php?tid=138 <-- My MBS routine. (Mouse Button Status)
It doesn't do double clicks natively, but it does give you clicks and once you have those, the code for double clicks is rather trivial to add. (It does the all important click, hover, hold, drag events for us.)
untested pseudocode written on my ipad, so it may need a little tweaking, but that's the general concept behind the process.
Get a click... start a timer. If you get a second click in the allotted time, it's a double click. If the time passes without that second click coming, it's a single click.
MBS works good with this simple little code as it already deals with the hold events and such for us. I *could* add in the double-click to the routine, but it honestly seemed unnecessary and just something extra to track and process when most programs don't need it. It's easy enough to add into a program, like above, for those cases where a double click is actually warranted.
It doesn't do double clicks natively, but it does give you clicks and once you have those, the code for double clicks is rather trivial to add. (It does the all important click, hover, hold, drag events for us.)
Code: (Select All)
Do
result = mbs
if result = 1 then 'right mouse click, check results
click = click + 1
if click = 2 then
tick_timer = 0 'no need to wait any longer; we have our double click already
else
tick_timer = TIMER(0.001) + 0.2 'two tenths of a second to double click
end if
end if
if click then
if TIMER > tick_timer then 'we've passed that 0.2 seconds of time for a double click
if click = 2 then
'it's a double click
else then
'it's a single click click
end if
end if
click = 0: tick_timer = 0 'reset counter and timer
end if
LOOP
untested pseudocode written on my ipad, so it may need a little tweaking, but that's the general concept behind the process.
Get a click... start a timer. If you get a second click in the allotted time, it's a double click. If the time passes without that second click coming, it's a single click.
MBS works good with this simple little code as it already deals with the hold events and such for us. I *could* add in the double-click to the routine, but it honestly seemed unnecessary and just something extra to track and process when most programs don't need it. It's easy enough to add into a program, like above, for those cases where a double click is actually warranted.

