Set Minimum Panel Dimension in LabWindows™/CVI™

Updated Jan 4, 2019

Reported In


  • LabWindows/CVI

Issue Details

I am developing a LabWindows™/CVI application. I would like to prevent the user to resize the panel below a minimum dimension.
I tried to enable Scale Contents On Resize under Other Attributes in Edit Panel dialog, and set desired values for Min Panel Height When Scaling and Min Panel Width When Scaling attributes, as shown below:
However, when I run the application, the user can resize the panel with no limitations.
How can I set height and width minimum values for a LabWindows™/CVI panel?


The behavior you are experiencing using Min Panel Height When Scaling and Min Panel Width When Scaling attributes is expected since these attributes are not setting the minimum panel width/height under which the user cannot resize the panel. They instead specify the smallest panel height/width for which scaling is allowed: the user can resize the panel under these values, but the content area will be clipped.

To prevent the user from resizing the panel under a minimum height and width, you need to programmatically set panel width and height attributes in a callback function, responding alternatively to one of the following two events:
  • EVENT_PANEL_SIZE event, which is executed after the user resized the panel. In the callback, you should use SetPanelSize function, as demonstrated in the following example:
int CVICALLBACK PanelCall (int panel, int event, void *callbackData,
                           int eventData1, int eventData2)
    int sizeW;
    int sizeH;
    switch (event)
        case EVENT_CLOSE:
             QuitUserInterface (0); 
        case EVENT_PANEL_SIZE:
          GetPanelAttribute (panelHandle, ATTR_HEIGHT, &sizeH);
          GetPanelAttribute (panelHandle, ATTR_WIDTH, &sizeW);
          SetCtrlVal (panelHandle, PANEL_Size, sizeH);
          if ((sizeH <= 200)||(sizeW <= 300))
                SetPanelSize (panelHandle, 200, 300);
    return 0;

  • EVENT_PANEL_SIZING event, which is generated as the user resizes the panel. You can find an example, called ​events.cws, in LabWindows™/CVI Example Finder, by selecting Help » Find Examples » Building User Interfaces » Acquiring User Input » General. When the event occurs, SetPanelEventRect function is called in order to change the size of the panel.


Not Helpful