01-03-2012 03:02 PM
I want to perform some actions when handling Mouse Move event only when Ctrl key is pressed. Is there a way to determine pressed state of Ctrl key?
01-03-2012 03:09 PM
Since you're already using an event structure (presumably in a loop), the easiest thing would be to add a Key Down and Key Up event and use that to toggle a boolean flag which will be in a shift register. Then you look at that flag in the mouse move event. I'm not sure whether the Ctrl key is in the list of keys returned by the terminal, but there should be a special terminal for modifiers which should give you the Ctrl state.
01-04-2012 04:13 AM
This does not look nice. I am sure there can be a way to get current keyboard state. Isn't it?
01-04-2012 04:23 AM - edited 01-04-2012 04:24 AM
Hi jonni,
"This does not look nice"
The user doesn't see the block diagram, so the look is irrelevant...
"a way to get current keyboard state"
- The MouseUp/Down events already give states of Ctrl and Shift keys.
- Use the input device VIs to poll the current keyboard state...
01-04-2012 01:02 PM
Even if user does not see our code I think it still needs to be nice and clean.
I do not use Mouse Up/Down, I use Mouse Move.
Looks like only input devices vis are straight forward solution.
01-04-2012 01:57 PM
Hi Jonni,
I've attached a simple example VI that uses the Mouse Move event filter to check for mouse movement and calls user32.dll to check if CTRL key is pressed. I think that is what you are looking for.