LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Mouse event

Hi,

 

On a control, I need a click to switch display between 2 values, and a double click to enter a new value for the value actually shown.

 

I wrote something like that :

 

int CVICALLBACK OkCallback (int panel, int control, int event,  void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
// do something
break;
case EVENT_RIGHT_CLICK:
// If value A displayed, display value B else display value A
break;

case EVENT_RIGHT_DOUBLE_CLICK:
// If value A displayed, enter new value A else enter new value B
break;
}
return 0;
}

 

 

The problem is that if I double click on the control, the callback is called twice. A fisrt time with EVENT_RIGHT_CLICK and a second time with EVENT_RIGHT_DOUBLE_CLICK event

 

How can I do ?

 

I tried to replace EVENT_RIGHT_CLICK with EVENT_MOUSE_WHEEL_SCROLL but when I scroll the wheel this event is not sent. Why ? 

 

Regards.

0 Kudos
Message 1 of 5
(4,733 Views)

Hello I tested this code it works well

 

http://digital.ni.com/public.nsf/allkb/9C37374EDA404D02862569ED00566B5F?OpenDocument

 

Regards

 

Samuel G. | GEMESIS

Certified LabVIEW Architect

Certified TestStand Developer

GEMESIS.EU

0 Kudos
Message 2 of 5
(4,591 Views)

Hello,

 

Thank you for your answer.

 

I created a new project with this code :

 

int CVICALLBACK MouseClickTest (int panel, int control, int event,void *callbackData, int eventData1, int eventData2)
{
   switch (event)
   {
    case EVENT_LEFT_DOUBLE_CLICK: // Catch double left-clicks
        MessagePopup("Debug", "DOUBLE_CLICK");
      break;

 

    case EVENT_LEFT_CLICK: // Catch single left-clicks
         MessagePopup("Debug", "CLICK");
      break;
   }

   return 0;
}

 

and it does not work.

 

I can't see DOUBLE_CLICK message popup, even if I click the mouse button extremely fast, as it is sait at the end of the link you posted.

 

Regards.

 

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

hello,

I used the code of callback exemple and I added the case structure.

Could you try it

 

 

Regards.

 

Samuel G. | GEMESIS

Certified LabVIEW Architect

Certified TestStand Developer

GEMESIS.EU

0 Kudos
Message 4 of 5
(4,576 Views)

Hello,

 

Thank you for your help.

 

It doesn't work. Same problem.

 

Code of "EVENT_LEFT_CLICK" is executed first when I make a double click.

 

 

 

0 Kudos
Message 5 of 5
(4,558 Views)