Mouse Button Status (MBS) - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Prolific Programmers (https://qb64phoenix.com/forum/forumdisplay.php?fid=26) +---- Forum: SMcNeill (https://qb64phoenix.com/forum/forumdisplay.php?fid=29) +---- Thread: Mouse Button Status (MBS) (/showthread.php?tid=138) |
Mouse Button Status (MBS) - SMcNeill - 04-23-2022 Code: (Select All) _Title "MBS (Mouse Button Status) by Steve" ' 12-17-2020 // updated 4/23/2022 I had one of these somewhere before, but I'll be danged if I can find it, so I rolled another one... A simple routine to check the mouse buttons and to give us information on up/down, click, and hold statuses, as well as hold start/stop positions. Results are all stored in a single binary integer, and basically break down to: 1 -- left down 2 -- right down 4 -- middle down 8 -- left clicked 16 -- right clicked 32 -- middle clicked 64 -- left held 128 -- right held 256 -- middle held 512 -- scroll down 1024 -- scroll up Starting X/Y and Ending X/Y positions are available in the shared Mouse_ variables. Note, HOLD and CLICK events are independent of each other. We don't register a free click with each hold event. Windows tends to count first down events as clicks, so all hold events start with a click event and then transition into a hold event. I didn't need that for my purposes, so this will either give you a hold event OR a click event; not both. RE: Mouse Button Status (MBS) - OldMoses - 04-25-2022 This is one of my favorite go to functions for mouse work. When they fixed the recursive bug, it stopped working, so I just removed all the 'MBS OR' clauses from the code, and while I wasn't sure if that work around ruined your intended functioning, it continued to work well in my programs. My mouse use is not too complex so that might have kept me from having problems. I'll be changing to this version ASAP. Thanks for the update. RE: Mouse Button Status (MBS) - SMcNeill - 04-25-2022 Always glad when I find out someone can make use of something I shared. If you have any other routines of mine which glitched out with you during the fix to recursive function, post them somewhere and @me and I'll be happy to take a look and fix them for you. RE: Mouse Button Status (MBS) - MrCreemy - 12-27-2022 I can remember having all sorts of gremlins with mouse routines. I ended up with differing routines for windows and linux versions of my programs reading this? I am noting the "windows does this..." exception, which sounds like what my issue might have been. |