LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Handle titlebar event

Hello,
I'm trying to handle a left double click event on the titlebar of a child panel (in order to maximize this child panel in its parent) but no callback function seems to handle that. Is there a way to do that?
Thanks.

Yann COLLET
Sercel - NANTES
0 Kudos
Message 1 of 2
(2,715 Views)
I couldn't find an event triggered by a doubleclick on a child panel titlebar. It doesn't look to me like it triggers an event on the child panel or on the main panel (except for EVENT_LOST_FOCUS and EVENT_GOT_FOCUS if the child panel didn't have focus to start with.
However, with a few lines of code, you can detect the double click yourself.
The Programmer's Toolkit has extended mouse events, including EVENT_LEFT_MOUSE_UP.
1. Add ..\CVI\toolslib\toolbox\toolbox.fp to your project.
2. Call EnableExtendedMouseEvents on any control on the child panel.
3. In the control callback for which you called EnableExtendedMouseEvents, create static variables to hold time and a click count.
4. In the same control callback, add a case for EVENT_LEFT_MOUSE_UP.
5. If the time from one EVENT_LEFT_MOUSE_UP to the next is fast enough to be called a double-click, check the mouse coordinates (in eventData1 and eventData2), and GetPanelAttribute on the child panel ATTR_TOP, ATTR_LEFT, ATTR_WIDTH, and ATTR_TITLEBAR_THICKNESS, to see if the click occured in the child titlebar.
See the attached example.
Message 2 of 2
(2,700 Views)