LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetCtrlVal & CommandButton

Hy,
 
I'm trying to get a 'mouseDown'  or ButtonDown function by simple using the  function 'GetCtrlAttribute (panel, control, ATTR_CTRL_VAL, &btVal)'
But the value, as I presse down this button (or don't press) is in both case zero.
Any ideas?
 
thanks
 
franky
 
 
0 Kudos
Message 1 of 3
(3,098 Views)


try using this.

Obtains information about the state of the mouse cursor.  The X and Y coordinates are set to the position of the mouse relative to the top, left corner of the screen.

Any of the parameters may be NULL.

/*-------------------- Prototype ---------------------*/
int GetGlobalMouseState (int *Panel_Handle, int *X-Coordinate,
                         int *Y-Coordinate,
                         int *Left_Button_Down,
                         int *Right_Button_Down,
                         int *Key_Modifiers);
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 2 of 3
(3,092 Views)

The reason why you cannot get the "button down" event is that on normal buttons the commit event is fired when you release the button: in fact you can press a button, maintain the mouse pressed and move the pointer outside the control and then release the mouse: no commit event is fired in this case (as is in almost all windows applications).

Sheetal suggestion seems the most reasonable way to handle your case, apart that it's a functon, not a callback, This means that you will need to call it in a loop or in a callback fired by another event.

Nevertheless, before the commit event is generated EVENT_LEFT_CLICK and EVENT_RIGHT_CLICK events are fired, so you could use them to trigger your function.

Another way to mimic a mouse pressed event is to change your button to a toggle button: in this case the commit event is generated when you press it..



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 3
(3,088 Views)