Jump to content

Scaling a sub panel while resizing


Recommended Posts

I have been trying to get the VI within a sub panel to re-size dynamically (while the users is actively performing a re-size).

I have programmed the VI in the sub panel to do real time re-sizing but I cannot get the sub panel to re-size actively when the user re-sizes the front panel that owns the sub panel.  Even if you set the 'Scale all objects on the front panel as the window re-sizes' VI property, the re-size does not happen until the user stops the re-size action.  It will not do it dynamically.

My solution was to create a vertical and horizontal splitter, then place my sub panel to the right and below the splitters.  I could then get it to resize the sub panel as the user performs the resize action.

The problem I am left with is I cannot completly hide the splitters.  No matter what type of splitter I choose or what color I set it to or how narrow I try to make it, I still end up with a border on the top and left of the front panel a few pixels wide.

 

My LabVIEW-fu and Google-fu has failed me on this one.  Has anyone else solved this?

 

thanks for any ideas!

 

-John

Link to comment

The problem is when trying to make the splitter zero pixels and place it at the extreme edge of the screen.  You still get a gap of a few pixels.

I have been able to eliminate one of the splitters but I am still stuck with having one.  Here is what it looks like:

post-2411-0-01759000-1370037186.png

Link to comment
The problem is when trying to make the splitter zero pixels and place it at the extreme edge of the screen.  You still get a gap of a few pixels.

I have been able to eliminate one of the splitters but I am still stuck with having one.  Here is what it looks like:

attachicon.gifvisible splitter.png

Ah, yes that makes sense.  I don't think you can make any splitter zero pixels, though I'd love to be proven wrong.

Link to comment
I have been trying to get the VI within a sub panel to re-size dynamically (while the users is actively performing a re-size).

I have programmed the VI in the sub panel to do real time re-sizing but I cannot get the sub panel to re-size actively when the user re-sizes the front panel that owns the sub panel.  Even if you set the 'Scale all objects on the front panel as the window re-sizes' VI property, the re-size does not happen until the user stops the re-size action.  It will not do it dynamically.

My solution was to create a vertical and horizontal splitter, then place my sub panel to the right and below the splitters.  I could then get it to resize the sub panel as the user performs the resize action.

 

 

The whole splitter business shouldn't even be necessary -- if I understand your original request, the features you describe are native. (this demo uses LabVIEW2012 12.0.1F1 32-bit)

 

Inspect settings on the two VIs attached (Container.vi and Containee.vi -- save them in the same directory) and check the 25sec screencast below to see if it demonstrates the behavior you're trying to achieve:

 

http://screencast.com/t/84aalWkNw

Containee.vi

Container.vi

  • Like 1
Link to comment
Doh!  Try this one: http://screencast.com/t/Nq9KVfgI

Wow I've never seen that happen before.  You ran that VI un edited?  I had normal results sorry.  One thing I'd be curious about is if you use the invoke node to Fit Control to Pane (on the sub panel, or the tree) does it fix this?  To be clear I don't think you should have to do this to have it function properly I'm just wondering if this would fix the issue.

Link to comment
Wow I've never seen that happen before.  You ran that VI un edited?  I had normal results sorry.  One thing I'd be curious about is if you use the invoke node to Fit Control to Pane (on the sub panel, or the tree) does it fix this?  To be clear I don't think you should have to do this to have it function properly I'm just wondering if this would fix the issue.

Yes.  Just D/Led and tried it.  Same version of LV too.

I did try the Fit Control to Pane in the resize event.  works even worse.

 

Best performance I can get is to use one vertical splitter bar and have the sub panel resize to that.  The resize event is also passed to the VI in the sub-panel and that is where I have my custom resize code that adjusts my list box column widths.  Still a bit laggy if they move the window edge too fast but it does catch up when they stop.

Link to comment

There are no zero-pixel width splitters. (Sorry - I know they would be really useful).

 

But Jack is correct that this should work without the top-level splitters.

 

My recommendation is to avoid the VI property "Scale all objects on front panel as the window resizes." It almost never does what you want.

 

Jack's example VIs work for me, but I'm guessing they are behaving differently for you because of this setting. I'm attaching a modified example that does not have that setting. Can you let me know if it works for you?

 

Also, the "Scale Objects While Resizing" setting on the Pane (which Jack has set) is pretty important. It's not set on new VIs and it's in a really weird place (right-clicking on the scrollbar to get the shortcut menu with the Pane Sizing options).

Container (1).vi

Containee (1).vi

  • Like 1
Link to comment

Also, the "Scale Objects While Resizing" setting on the Pane (which Jack has set) is pretty important. It's not set on new VIs and it's in a really weird place (right-clicking on the scrollbar to get the shortcut menu with the Pane Sizing options).

Ok, your version works as expected on my machine.  But there is no scroll bar on the Container.vi.  How do you get it back to adjust the setting?  If I create a VI, drop a sub-panel and then select 'fit to pane', the scroll bars seem to be gone for good.  I must be missing something...  (other than the scroll bars).

Finally, why is this "Scale Objects While Resizing" setting not available via VI Server?

Link to comment
My recommendation is to avoid the VI property "Scale all objects on front panel as the window resizes." It almost never does what you want.

 

For clarity -- and don't let me put words in your mouth! -- but for clarity i think you mean to avoid "Scale all Objects with Pane" (because, it almost never does what you want) -- and you typically *always* want to enable "Scale Objects While Resizing" because hardware is more capable today than it was in the 1900's. :-)

 

This is typically the setting you'll want for Panes:

 

post-17237-0-55812600-1370310100.png

  • Like 2
Link to comment
Still need an easy way to get those scroll bars back and this still needs to be a VI Server setting!

 

There are four ways to turns on scroll bars:

 

1. VI Properties (CTRL+I) >> Window Appearance >> Show vertical/horizontal scroll bar

 

post-17237-0-07561100-1370334912.png

 

2. Context Menu of an existing scroll bar:

 

post-17237-0-10424800-1370334993.png

 

3. Context Menu of a splitter between two panes:

 

post-17237-0-85949000-1370335058_thumb.p

 

4. And as a property node of Pane (also shown, a lesser known fact -- you can show, customize, then hide the Labels on both Splitters and Panes to be more descriptive than Pane, Pane 2, Pane 3, Pane 4...) A mistake I oftentimes make is to search for Pane settings under the Panel class -- Class Browser (CTRL+Shift+B) helps remind.

 

post-17237-0-44243000-1370335369_thumb.p

Link to comment
...and you typically *always* want to enable "Scale Objects While Resizing" because hardware is more capable today than it was in the 1900's. :-)

I also set this every time I'm doing any nice UI stuff.  Too bad it can't be set programatically.

 

http://forums.ni.com/t5/LabVIEW/Setting-quot-Scale-Objects-While-Resizing-quot-programmatically/td-p/1970005

Link to comment

Slightly high-jacking this topic, re-sizing items in a tab control in a way that is similar to the resizing of panes is a feature I've been looking for for a while.  To give you an example, for many of my GUIs I have a graph in a tab control, and have the raw data table in another tab.  If tab controls could resize their contents like a pane, my graph and table could automatically re-size with my window (I would put the tab control in a pane and set it to Fit Control to Pane.  For this reason I've put off converting many of my GUIs to being resizable using splitter bars.

 

Any ideas as to how I could implement something that could achieve similar results?

 

Thanks,

Bruce

Link to comment
Any ideas as to how I could implement something that could achieve similar results?

 

Thanks,

Bruce

The only way I've been able to do this is by cheating.  I would have a horizontal splitter with only the tabs in the top pane, and the contents of the tabs in the lower pane.  Then when you change the value in the top tab control it changes the value in the bottom tab control.  Then when the bottom tab control changes value, I also fit the appropriate control to the pane.  This gives the illusion of a single tab that fits to the pane but really it is two tabs.

 

This technique falls apart if you try to have more complicated controls then just a single graph, or table in each tab.  It is still do-able but I've found my self performing manual resizing of controls if the pane is resized. 

 

Attached is a quick demo that uses a graph, a single column listbox and a table.

Cheating Tabs.vi

Link to comment

Slightly high-jacking this topic, re-sizing items in a tab control in a way that is similar to the resizing of panes is a feature I've been looking for for a while.  To give you an example, for many of my GUIs I have a graph in a tab control, and have the raw data table in another tab.  If tab controls could resize their contents like a pane, my graph and table could automatically re-size with my window (I would put the tab control in a pane and set it to Fit Control to Pane.  For this reason I've put off converting many of my GUIs to being resizable using splitter bars.

The only way I've been able to do this is by cheating.  I would have a horizontal splitter with only the tabs in the top pane, and the contents of the tabs in the lower pane.

 

Highest recommendations for checking out XTab by Saphir, available for download through the LabVIEW Tools Network using VIPM.

 

* It handles resizing of tab contents no prob, since the tab contents are just a VI

* You can add/remove pages programmatically

* You can re-order and even pop out tabs into new windows (à la Chrome browser)

* The toolkit is free

 

Here's a screencast that shows XTab in action: http://www.dailymotion.com/video/xmtmvf_topaze-tab-navigation_tech#.Ua4DsGRgZyE

More info on the community: https://decibel.ni.com/content/docs/DOC-21668

Link to comment
The only way I've been able to do this is by cheating.  I would have a horizontal splitter with only the tabs in the top pane, and the contents of the tabs in the lower pane.  Then when you change the value in the top tab control it changes the value in the bottom tab control.  Then when the bottom tab control changes value, I also fit the appropriate control to the pane.  This gives the illusion of a single tab that fits to the pane but really it is two tabs.

 

This technique falls apart if you try to have more complicated controls then just a single graph, or table in each tab.  It is still do-able but I've found my self performing manual resizing of controls if the pane is resized. 

 

Attached is a quick demo that uses a graph, a single column listbox and a table.

 

Thanks!  Your workaround is quite sneaky into fooling the user that the tab panes are actually being displayed.  I didn't realize you could get this effect by having multiple controls on top of eachother and using that method.

 

Highest recommendations for checking out XTab by Saphir, available for download through the LabVIEW Tools Network using VIPM.

 

* It handles resizing of tab contents no prob, since the tab contents are just a VI

* You can add/remove pages programmatically

* You can re-order and even pop out tabs into new windows (à la Chrome browser)

* The toolkit is free

 

Here's a screencast that shows XTab in action: http://www.dailymotion.com/video/xmtmvf_topaze-tab-navigation_tech#.Ua4DsGRgZyE

More info on the community: https://decibel.ni.com/content/docs/DOC-21668

I've downloaded this toolkit and will give it a whirl.

 

Thanks!  (I guess hijacking this thread was a good idea after all!)

Bruce

Link to comment

I appove of the thread jacking because it led me to some more interesting tools, but to get back on topic:

There are four ways to turns on scroll bars:

 

1. VI Properties (CTRL+I) >> Window Appearance >> Show vertical/horizontal scroll bar

 

 

2. Context Menu of an existing scroll bar:

 

 

3. Context Menu of a splitter between two panes:

 

4. And as a property node of Pane (also shown, a lesser known fact -- you can show, customize, then hide the Labels on both Splitters and Panes to be more descriptive than Pane, Pane 2, Pane 3, Pane 4...) A mistake I oftentimes make is to search for Pane settings under the Panel class -- Class Browser (CTRL+Shift+B) helps remind.

 

I should have thought of #1.  Thanks for pointing out the obvious and easy solution. :thumbup1:

#2 and #3 won't work once you have lost the scroll bars and have no splitters.

I ended up doing a variation of #4 before I saw your reply.

 

In the end all is well but I agree that the setting should be the default.  It would have no effect on normal VIs until you set a control to scale.  So, why not?  I bet this is already on the idea exchange somewhere...

 

Now to go off and redo all my code using that cool tab x-control!   :D

Link to comment
After a day of playing with the XTab control, I can say that is looks promising but is too buggy for real world use at this point.  I hope the author continues to improve it.  In the meantime, I would recommend you look elsewhere for a tab solution.

 

Stay tuned -- perhaps some of these concerns are addressed in unreleased versions and a nudge is all it takes....  :)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.