LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set the Min Max attributes on a panel that is sizeable?

I am using LabWindows/CVI. I have created a duplicate panel and I have made the duplicate panel sizeable. Now I would like to set the minimum value and the maximum value for the PANEL when the user is resizing the panel. When I read the Panel Attributes, there is no min max for the panel, only for the controls. Can I set the min max for the panel?
Thanks,
Donna
0 Kudos
Message 1 of 3
(3,151 Views)
You can force a minimum size in your code by watching EVENT_PANEL_SIZE. This way, if the user tries to resize to a smaller size than you want, your code will resize the panel to your specified minimums as soon as the user lets go of the mouse button.
1. In the UI editor, double click on a blank spot on your panel to edit the panel.
2. Enter a function name (e.g. PanelCallback) in the box labeled Callback Function, and click OK.
3. In the UI editor, click on Code >> Generate >> Panel Callback.
4. In the UI editor, click on Code >> View >> Panel Callback.
5. At the top of your PanelCallback function, add variable declarations:
int panelWidth, panelHeight;
int resize = 0;
6. Under switch(event), add a new case:
case EVENT_PANEL_SIZE:
GetPanelAttribute (panelHandle
, ATTR_HEIGHT, &panelHeight);
GetPanelAttribute (panelHandle, ATTR_WIDTH, &panelWidth);
if (panelHeight < MINPANELHEIGHT)
{
panelHeight = MINPANELHEIGHT;
resize = 1;
}
if (panelWidth < MINPANELWIDTH)
{
panelWidth = MINPANELWIDTH;
resize = 1;
}
if (resize)
SetPanelSize (panelHandle, panelHeight, panelWidth);
break;
6. At the top of your .c file, or in your .h file, add the definitions:
#define MINPANELWIDTH 300 //or whatever
#define MINPANELHEIGHT 200 //or whatever
0 Kudos
Message 2 of 3
(3,151 Views)
Thank you for your response. It is hard to believe that something as basic as a MIN MAX for a panel is not as easy as setting an attribute. Is this capability scheduled for a later release of LabWindows/CVI?
Donna
0 Kudos
Message 3 of 3
(3,151 Views)