Jump to content

Dynamic Control Instantiation and Docking


Recommended Posts

Hi all,

I have a Labview application in which I want the user to be able to create any number of floating panels that could be [value displays/interactive panels/status information]. Different panel types can be different sizes. I also need these panels to be dockable and the dock area must be scrollable if there are too many panels. I have done something similar already, where I clone any number of template VIs. However, this only gets me a fraction of the way. Is there still no way to instantiate controls dynamically? I have played with panes and drag and drop, but this didn't get me far either. The best I have so far is to drag controls into an array, but of course all the controls must be identical in type and size. Is there a way to instantiate a VI from a template and then transfer the created controls from the instantiated VI to the main VI? I have seen the example that does docking with SubPanels, but that doesn't help much either.

Many thanks,

Christie

Link to comment

Having worked with LabVIEW for a few years now, it seems to me that such dynamic user interfaces are simply nigh-impossible in LabVIEW. The way the front panel / terminal / block diagram system has been designed has some strong advantages, but dynamic control instantiation seems to be fundamentally incompatible with this paradigm.

If you really think this type of UI is useful, you should consider using a different tool — .NET for example. There's plenty of extensive libraries for this sort of thing in the .NET world. You really don't want to solve the intricate usability issues of docking/undocking etc. yourself, if you don't have to :)

On the other hand: does the UI you have in mind really solve concrete user problems? My experience thus far tells me that often a well-designed, static UI trumps an overly-configurable, dynamic UI. Especially for "your average user" (whatever that may be), too much configurability makes an application harder to use. For a good example on this, read the interesting story of how the Microsoft Office Ribbon UI was conceived. There's a reason Microsoft turned its back on the mess of floating toolbars, dynamic menus and over-configurability that was MS Office 2000-2003. (Even though, personally, I quite liked it!)

One additional tip, to make this downer-of-a-reply a bit more useful: you can look into LabVIEW OOP (Object Oriented Programming), and the Actor Framework, to see some examples of how you can make a UI more 'customizable' — by, for example, making multiple versions of the same UI, and decouple those UIs from the underlying actual program. Let me know if I'm being too vague here, or if you'd like some more concrete pointers.

Best regards,

Onno

  • Like 1
Link to comment

The closest I think you can come is using nested subpanels. Top level VI is simply one with two subpanels. It hosts one of your dynamic UIs in one and a clone of itself in the other, which in turn hosts another UI and another clone. Keep going until done. You then would need to manage the scrollbar on the top level VI, along with the size of all the nested panels.

In theory doable, but very messy. I have an app I'd like to do this in, bit the kludginess of it all has turned me off even trying. The good news is that this should be doable in a fairly extensible way, but I agree dynamic control creation would be way better.

  • Like 1
Link to comment

Something I have done in the past is to create a set number of subpanels and then have a library of functions to handle sizing, positioning, loading, and unloading of VIs through an interface. You are limited to the number of subpanels you create initially, but as you place them on the front panel, the regular scrollbars will allow you to move around the panel. As a bonus, it becomes very easy to save the template so the user can pull the exact same layout up again. The unused subpanels are shrunken and moved off screen. My system used 30 subpanels and I never had any performance issues, even on some 2005 era single-core computers.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.