Jump to content
Sign in to follow this  
Mark Yedinak

Programmatically resizing a cluster and it's elements

Recommended Posts

Does anyone have a good example or an easy method to resize a cluster programmatically. Specifically, I have a cluster which is a progress bar that contains several elements (the slider, string, remaining time) and I would like this cluster to resize when the panel is resized. The panel is a display window which is echoing data that is being transmitted to a device. In some cases the data takes quite some time and the progress bar is used in these cases. The user can resize the window and I would like to have the progress bar's width expand to the width of the panel. This will also mean that some of the internal elements will need to be repositioned. I was planning on using the resize panel event and then use the property nodes (bounds and positions) of the elements but they are coming up as read only. Any suggestions?

Share this post


Link to post
Share on other sites

QUOTE (Mark Yedinak @ Dec 12 2008, 03:43 PM)

Does anyone have a good example or an easy method to resize a cluster programmatically.

I don't think you can force a cluster to do this. The cluster border will scale, but the contents won't. However, it should be easy to unbundle the cluster items for the purpose of displaying them.

Then if you want them to scale in different ways, use splitter bars and panes to do it ( I think that's exactly why they were added to LabVIEW, though I haven't tried.).

Look at

C:\Program Files\National Instruments\LabVIEW 8.6\examples\general\controls\splitter.llb\Multi-Panel Front Panel using Splitter Bars.vi

That example just has the graph scaling with its pane, but you can set the other controls to scale with their panes and you start to see the possibilities.

Good luck.

Share this post


Link to post
Share on other sites

The bounds property is always read-only. Each class of control has other properties for setting its size, although the ones for the cluster class are not exposed, if memory serves.

What you can do is set the cluster to auto-size and then use the properties of the controls inside the cluster to move them around. This will change the size of the cluster as well.

Share this post


Link to post
Share on other sites

Thanks for the suggestions. The splitter bars seem to do the trick quite nicely. However I do have one more question. Is it possible to quickly and easily turn a pane's visibility on or off. In my application the progress bar will not always be visible. It is only displayed if the transaction will take a significant amount of time. I wold like to hide the progress bar when it is not active. It would seem that being able to hide whole panes would be a useful feature but this does not appear to be possible via the property nodes. In my application I actually have two separate panes that I would like to be able to hide. One is on the top of the window (some general status information) and the other (the progress bar) is on the bottom. I will take a look at playing with the origin settings and setting the panel size accordingly but I was hoping there would be a more simple solution.

Thanks again

Share this post


Link to post
Share on other sites

Resizing the window sounds like a bad UI design to me. If you just want what's in the pane to be invisible, you can just make the individual controls invisible (e.g. by using the Controls[] property). I don't know if the pane has a Visible property, but I can't say it seems to make sense.

P.S. For a progress bar, you might wish to open a separate VI and transfer the progress using a notifier or another mechanism.

Share this post


Link to post
Share on other sites

QUOTE (Yair @ Dec 16 2008, 11:29 AM)

I have attached an example of the code. This version is for testing however it is easier to see what I am looking to do. I have checked to see if individual panes have a visible attribute or not and they don't. That was the first thing I looked for. I want to avoid using a floating progress bar because this solution will be used in an environment will multiple such windows will be available and a separate detached progress bar will be difficult for a user to know what progress is being reported. I want to keep the progress bar linked to the specific task. I can simply change the progress bar's visual state but then the window has a significant portion of it that is empty. My decision to resize the pane is really a work around for the lack of a visibility attribute on an individual pane.

Here are some screen shots to illustrate what I am trying to accomplish:

Display window with hidden progress bar:

post-4959-1229459456.jpg?width=400

Display window with visible progress bar:

post-4959-1229459482.jpg?width=400

Display window with invisible progress bar:

post-4959-1229459491.jpg?width=400

As you can see the hidden progress bar looks cleaner than the one where it is simple not visible.

Sample code: Download File:post-4959-1229459430.zip

Share this post


Link to post
Share on other sites

Maybe you could use a subpanel for this? I don't know whether this is a "good" or "correct" idea, but I think it's do-able. It would mean a little extra code and, of course, a subVI.

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

×
×
  • Create New...

Important Information

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