LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Bug with extended mouse events?

CVI 6

I have a panel with a menu and a graph control. Extended mouse events are enabled.

When I select a menu item on the panel, and let go of the mouse, the *graph control* receives a left_mouse_up event, while it didn't receive any click event. The mouse isn't anywhere near the graph when selecting the menu item by clicking (and letting go) on it. How come this event occurs?

Greetings,

Erwin Timmerman
0 Kudos
Message 1 of 3
(3,357 Views)
When you call EnableExtendedMouseEvents, you tell it which control you want to receive the extended mouse event. It sounds like you told it to use the callback for the graph control. The extended mouse events will be handled by the callback for control you specified in EnableExtendedMouseEvents regardless of where the event took place.
What do you want to do on EVENT_LEFT_MOUSE_UP? If you don't want to handle it, don't include a case for it. If you want to handle it for some other control or for the panel, you can set a global flag for EVENT_LEFT_CLICK in the callback for that control or panel. You won't have EVENT_LEFT_MOUSE_UP without first getting EVENT_LEFT_CLICK. Then in the callback specified in EnableExtendedMouseEvents, check if the global is set, handle the EVENT_LEFT_MOUSE_UP as desired, then clear the global flag for EVENT_LEFT_CLICK.
Message 2 of 3
(3,354 Views)
The graph control is indeed the control assigned to receive the extended mouse events. Your story would indeed explain why there is a mouse up event without a clicking event. The left click goes to the menu item, and the left mouse up to the graph control.

I only need the mouse up event for the graph control, so I had already added an extra callback variable which checks if there was a left click on the graph first. If there wasn't, the callback ignores the left up event. It works perfectly that way but I was wondering why the event happened in the first place.

Thanks for the explanation! It turns out to be a feature, not a bug 😉

Erwin Timmerman
0 Kudos
Message 3 of 3
(3,351 Views)