LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

simulate a mouse left click on the position

Is there any commands that i can use in Labwindows for simulating a left mouse click?

thanks

weeliat
0 Kudos
Message 1 of 3
(4,111 Views)
Use can use the EVENT_LEFT_DOUBLE_CLICK or EVENT_LEFT_CLICK statement in LabWindows\CVI.

Below is some information from the help section of LabWindows/CVI:

When users double-click with the left mouse button anywhere or a panel, an EVENT_LEFT_DOUBLE_CLICK event occurs, and is sent to the callback function associated with the panel, as well as to the callback function associated with the control over which the mouse click took place.
0 Kudos
Message 2 of 3
(4,111 Views)
The easiest way to simulate a left-mouse click is by calling the callback you have associated with the control and passing the EVENT_LEFT_CLICK as the third parameter. I say the third parameter because all control callbacks have the following prototype/signature:

int CVICALLBACK Acallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)

Note that this method will not visually change your control. For example if we have a command button on a panel, simulating the left-click will not press the button. It will just execute the code associated with such event.

Another (harder) option would be to simulate a keystroke you have associated with your control with the function FakeKeyStroke. This will visually change the control (as
in pressing it or giving it focus), and it will generate an EVENT_COMMIT event, instead of a left-click. Either way, the control callback is executed.

Note:
An EVENT_COMMIT is generated when the user left-clicks and releases the mouse on top of the same control. On the other hand, an EVENT_LEFT_CLICK is generated when the user left-clicks on a control, regardless of wheter the user released the button on top of the control or elsewhere. As a result, an EVENT_LEFT_CLICK is always generated before an EVENT_COMMIT.

If you are interested in seeing which events are generated on controls, the User Interface Editor has four icons on the upper-left corner, just below the menu. Click on the left-most icon (a pointint hand) and start clicking on your controls. The events will appear on the upper-right corner as they are generated. Pretty cool !

Regards,
Azucena
NI
0 Kudos
Message 3 of 3
(4,111 Views)