LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple objects scaling with front panel?

Hi all,

I'm working on a VI where I just added a raw data table view feature to where there was once only a chart.  My plan was to add a tab control.  On one tab I have my chart, on the other tab I have my table scrolling the raw data.  However, it seems I can only set "Scale object with Pane" for only one of these three items: chart, table, or tab control.

Is there a way I can get all three of these to scale with resizing of the front panel?

Cheers,
Greg Cole
“It is not the ship so much as the skillful sailing that ensures the prosperous voyage.”
0 Kudos
Message 1 of 7
(4,272 Views)
Look in File>>VI Properties>>Window Size.

___________________
Try to take over the world!
0 Kudos
Message 2 of 7
(4,265 Views)
VI properties has this option of Window size, where you have 3 check boxes. one of these checkboxes is Scale objects as window resizes. this should resize all the objects in your front panel.
 
Pavitra
0 Kudos
Message 3 of 7
(4,261 Views)


@GReaper wrote:

Is there a way I can get all three of these to scale with resizing of the front panel?


The how has already been given to you. There is a warning however: Scaling controls is a very tricky business.

While it seems simple to just scale every control in whatever aspect ratio the window is scaled this does work
not very well since many objects are more complex than just a simple rectangle. For instance if there is text in there should the text be scaled as well or not? Apart from the fact that scaling text is not something that is supported very well by most Widnows versions, if you do not scale the text do you still want to scale the rest of the control, possibly ending up with a huge button with a relatively tiny text inside? Should only the outside of the control be scaled or all individual parts as well? For a table this could be column widths, scrollbars, etc. Basically there is no single good way but allowing to specify all this different aspects of scaling would make the editing of a front panel highly complex. LabVIEW chooses to not scale fonts and most subparts of controls but only the outer bounds which is usually ok but doesn't always give a nice result.

LabVIEW has one more problem at least < 8.0 and maybe in 8.0 too, and that is adaptive rounding errors. When scaling a control the new positions are rounded to integer values (you don't have half pixels on a screen) and these values are then used as start point at the next resize operation. Repeatingly resizing a window will slowly make the controls creep away and after a while the carefully aligned controls will not look so aligned anymore. Closing the window and reopening it will restart with the original positions so it is not a capital problem but it is a cosmetic issue.

Usually a much better aproach is to use the one control resize option. With this you have only one single control in the panel that is really resized and all the rest is only moved along depending on the relative position of those controls to the resized control. You select this mode by selecting the control you want to resize and then selecting in LabVIEw < 8.0 from the main menu "Edit->Scale Object with Panel" or in LabVIEW 8 select "Scale Object with Pane" in the context pop-up menu of that control.

Rolf Kalbermatter

Message Edited by rolfk on 04-06-2006 09:38 AM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 4 of 7
(4,259 Views)
Thanks for the replies.  The VI properties/Window size is not a route I want to take beause of the rounding and drifitng issues.  I actually dreamed up part of my solution over night.  An image is atached.  The short of it is I set the one control to scale with the pane, in this case the chart.  I then added an event handler for "Panel resize" and tied the table and tab sizing params to the chart. 

This works spiff for the VI running by itself.  The kicker is I load the VI as a subpanel in my main VI and the Panel resize event doesn't fall thru to the subpaneled VI.  I'm planning to try and call the subpaneled VI's resize event from the same event in the main somehow...

Cheers,

Greg Cole
“It is not the ship so much as the skillful sailing that ensures the prosperous voyage.”
0 Kudos
Message 5 of 7
(4,241 Views)
Dang, the image did not attach.  Trying again...


Greg Cole
“It is not the ship so much as the skillful sailing that ensures the prosperous voyage.”
0 Kudos
Message 6 of 7
(4,239 Views)
Just to complete the cycle here.  Having the above work as a subpaneled VI required on off screen boolean control I called "resize".  On a Panel Resize event in the main vi holding the subpanel I get the reference for the resize boolean control and set Value(signaling).  Then instead of the resizng calcs being done in the "Panel Resize" event in the subpaneled VI as before, I moved the code to the "Value Change" event handler for the resize control.

No drfiting or scaling problems (so far).  Only the control I want to resize...  resize.

And a note of trivia, it appears the array of controls you get off the panel reference are indexed by their tabbing order.

Cheers,
Greg Cole
“It is not the ship so much as the skillful sailing that ensures the prosperous voyage.”
0 Kudos
Message 7 of 7
(4,232 Views)