From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-19-2019 05:24 AM
Hi,
Can anyone advise me how I can confine mouse movement within an area/pane?
I have added a vertical container to split into two panes. When running the application, I would like to restrict user mouse movement to the left pane.
-Sable
Solved! Go to Solution.
05-19-2019 08:20 AM
I don't think you can,or should.
How would the user move outside of the VI windows if they wanted to do something else with like open another app, shutdown the PC?
05-19-2019 09:08 AM
I agree with RavensFan. Limiting the movement of the mouse cursor is not a good idea.
However, if you still want to do it, here is a VI (in LabVIEW 2016) that I created to test how to programmatically move the mouse cursor. My goal was to keep the mouse cursor outside of an area (the bait). The VI uses the SetCursorPos function of User32.dll that is available only on Windows in C:\Windows\System32.
You can stop the VI by pressing any key.
05-19-2019 12:10 PM
05-19-2019 01:00 PM
My intention is to confine the mouse cursor within a boundary only when the user starts to draw a ROI Line on an IMAQ image.
Once the user completes the drawing, I would like to undo the confinement.
ClipCursor works well.
I've attached the example code in LabVIEW 2013.
Question, how do I undo the confinement via LabVIEW back to it's original?
- Sable
05-20-2019 03:38 AM
Call ClipCursor again with a NULL pointer and it should release.
0xDEAD
05-20-2019 09:45 AM
Like this?
If yes, then it doesn't release it. It just confines the mouse at location 0,0. Top left of the screen.
05-20-2019 09:57 AM
Before you start clipping, use GetClipCursor() to read to get the current clip region and store this value. When you are finished, pass this value to ClipCursor() to restore it. That is the preferred way to handle this type of operation.
05-20-2019 10:06 AM
@Sable wrote:
Like this?
If yes, then it doesn't release it. It just confines the mouse at location 0,0. Top left of the screen.
No, not like that.
You have to make a 2nd clfn, with the input configured as value. Then wire a 0 to it.
A null pointer isn't the same as a cluster with zero's.
05-20-2019 11:19 AM
Like this? (please refer to the attached vi done on LabVIEW 2013).