Detect mouse leaving application's window in pure QB64 - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: Detect mouse leaving application's window in pure QB64 (/showthread.php?tid=2039) |
Detect mouse leaving application's window in pure QB64 - TempodiBasic - 09-26-2023 Hi Terry Hi Steve Hi all folks I need an help to be working well to 100% this my QB64 snippet that detects when mouse leaves the area of the application. Thanks to Steve, Bplus, GrymmJack and all you QB64 coders with your feedbacks and suggestions! Code: (Select All) Rem it is a code test to detect mouse out of window of application using only QB64 code How can it be improved? Thanks for feedbacks RE: Detect mouse leaving application's window in pure QB64 - SMcNeill - 09-27-2023 Here's my solution for this (for Windows, at least): https://qb64phoenix.com/forum/showthread.php?tid=2041 RE: Detect mouse leaving application's window in pure QB64 - James D Jarvis - 09-27-2023 Isn't the lack of mouseinput the easiest way to tell the mouse isn't in the window? In the image linked here there are 3 runs of the same little scribble application overlapping. The pixels only get drawn when the mouse is in the top overlapping window. I'm just a little confused on the reason to track the lack of mouse input in the window when ... none gets reported if the mouse isn't in the window. Am I missing something? RE: Detect mouse leaving application's window in pure QB64 - bplus - 09-27-2023 That is interesting seeing 3 exe's running. Is there code to detect other exe's running, get them talking to each other... Keypress responds to correct window chosen by mouse? You could have a Color Picker program up with a Paint One. You could have a file selector up with something that needs file names. RE: Detect mouse leaving application's window in pure QB64 - James D Jarvis - 09-27-2023 (09-27-2023, 02:37 PM)bplus Wrote: That is interesting seeing 3 exe's running. I posted something like that last year. RE: Detect mouse leaving application's window in pure QB64 - bplus - 09-27-2023 (09-27-2023, 02:39 PM)James D Jarvis Wrote:(09-27-2023, 02:37 PM)bplus Wrote: That is interesting seeing 3 exe's running. Come to think, I posted both of those also as independents for Clip Board values. RE: Detect mouse leaving application's window in pure QB64 - James D Jarvis - 09-27-2023 (09-27-2023, 02:42 PM)bplus Wrote:here's one I did: ClipScribble (qb64phoenix.com)(09-27-2023, 02:39 PM)James D Jarvis Wrote:(09-27-2023, 02:37 PM)bplus Wrote: That is interesting seeing 3 exe's running. RE: Detect mouse leaving application's window in pure QB64 - TempodiBasic - 09-29-2023 (09-27-2023, 01:53 PM)James D Jarvis Wrote: Isn't the lack of mouseinput the easiest way to tell the mouse isn't in the window? In the image linked here there are 3 runs of the same little scribble application overlapping. The pixels only get drawn when the mouse is in the top overlapping window. I'm just a little confused on the reason to track the lack of mouse input in the window when ... none gets reported if the mouse isn't in the window. Am I missing something? Hi James D Jarvis thanks for your feedback! about Quote:Isn't the lack of mouseinput the easiest way to tell the mouse isn't in the window?I think it is not so simple. Here in the bottom I post an image of 3 different apps (run) of the same program that I have posted here as a program that detects if mouse pointer is out or in the area of the window. As you can see, all three applications in running show a correct result about the position of the pointer of the mouse. So it seems that mouse information are shared among them. Moreover if you run this code you can see that also when mouse is out of window of the program after a call to _MouseInput you get back mouse informations like _MouseX and _MouseY, _MouseMovementX and _MouseMovementY. run this code to verify Code: (Select All) Rem it is a code test to detect mouse out of window of application Here a screenshot I dunno if it is right to get back info about mouse when it leaves the area of window's application. I think that it is the actual behaviour of the OS (MS Window). But Someoneelse can test the code in Linux or Mac platforms. Waiting more feedbacks RE: Detect mouse leaving application's window in pure QB64 - James D Jarvis - 10-04-2023 When I run that example program I noticed it does track mousemovement on my windows machine but does not report the mouseX or mouseY unless it's in the program window. I also noted (by adding the command) it only reports _mousebutton() clicks within the respective program window when the mouse is in them. RE: Detect mouse leaving application's window in pure QB64 - TempodiBasic - 10-09-2023 @James D Jarvis yes if you track _mousebutton() it can give the input only at the position where mouse is . So it gives input only for window pointed by mouse cursor. MouseX and MouseY give the exact position of the mouse in the window that is monitoring the mouse, but if the pointer of the mouse is out o f the window they return the last position on that window. MousemovementX and MousemovementY return the relative movement of mouse along X and Y axises. |