LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Callback called when mouse over

I have a button which have a callback. When the mouse is over the button (without click), the callback is called. I would like to have the callback called only on mouse click and not on mouse over. Is it possible ?
0 Kudos
Message 1 of 5
(3,799 Views)

yes, you have to choose another event, e.g. EVENT_LEFT_DOUBLE_CLICK,

 

e.g.

 

int CVICALLBACK Button ( int panel, int control, int event, void *callbackData, int eventData1, int eventData2 )
{
    if ( event == EVENT_LEFT_DOUBLE_CLICK )
    {
        ...

    }
    return ( 0 );
}

Message Edited by Wolfgang on 04-29-2010 12:18 PM
0 Kudos
Message 2 of 5
(3,798 Views)

Where can I choose an event ?

 

Please, see attache properties of the button.

 

Thanks. 

0 Kudos
Message 3 of 5
(3,793 Views)

Your callback will be called for lots of windows events. You can not change this behavior, instead you have to choose which event(s) you want to respond to by looking at the event  parameter in the callback function. Wolfgang's answer shows you how to do it.  Additional information is passed in the other callback function parameters - see the on-line help for details.

 

0 Kudos
Message 4 of 5
(3,782 Views)

sfl,

 

Right-click the button in UIR editor and choose View Control Callback.

You will be directed to the C-file that has the code for the button's callback.

 

In this (highlighted) callback function, you will see a switch-case statement.

Remove the block for the case EVENT_MOUSE_OVER. Simply select with cursor and delete.

 

To change the defualt event setting (to avoid getting this event for newly created buttons) :

Open your UIR file, and select Code > Preferences > Default Events from the menu.

 

There you can select for which events the code generator will create a case statement further on.

 

Hope this helps, 

S. Eren BALCI
IMESTEK
0 Kudos
Message 5 of 5
(3,769 Views)