LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

resize panels

Hello,
Is there a way to force a panel to be resized proportionnally, I mean, when
the user resizes the height (using the mouse), the width would automatically
be resized in proportion and vice-versa.

Best Regards,
Marco
0 Kudos
Message 1 of 3
(3,441 Views)
1. Create a callback function for your panel.
2. When you first display the panel, call GetPanelAttribute to get the width and height of the panel and store them to globals.
3. In the callback function for your panel, add a new case for EVENT_PANEL_SIZE.
3.1 In that case, call GetPanelAttribute to check the current height and width.
3.2 Compare them to the height and width global. If one is different, use a simple ratio to determine what the new (proportional) size should be. For example, if gPanelHeight and gPanelWidth are the global panel height and width,
if (newHeight != gPanelHeight)
newWidth = gPanelWidth * newHeight / gPanelHeight;
3.3 Store the new heigth and width to the globals
gPanelWidth = newWidth;
gPanelHeight = newHeight;
3.4 Call SetPanelSize
the set the new height and width.
0 Kudos
Message 2 of 3
(3,441 Views)
Thanks for your answer, this was my first idea, but I hoped there was an
easier way.
I will try this.

Best Regards,
Marco

"Marco" a écrit dans le message de
news:3f6ae573@newsgroups....
> Hello,
> Is there a way to force a panel to be resized proportionnally, I mean,
when
> the user resizes the height (using the mouse), the width would
automatically
> be resized in proportion and vice-versa.
>
> Best Regards,
> Marco
>
>
0 Kudos
Message 3 of 3
(3,441 Views)