Jump to content


Photo
- - - - -

Dynamic Control Instantiation and Docking

dynamic control intantiation docking

  • Please log in to reply
3 replies to this topic

#1 Cyberius

Cyberius

    Enough LAVA to be dangerous

  • Members
  • 4 posts
  • Location:United Kingdom
  • Version:LabVIEW 8.6
  • Since:2006

Posted 16 March 2012 - 09:27 AM

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

#2 Onno

Onno

    More Active

  • Members
  • PipPip
  • 29 posts
  • Location:Amsterdam, The Netherlands
  • Version:LabVIEW 2011
  • Since:2007

Posted 16 March 2012 - 10:34 AM

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
Science & Wires — on LabVIEW and scientific programming

#3 mje

mje

    The 500 club

  • Premium Member
  • 823 posts
  • Location:Milford MA USA
  • Version:LabVIEW 2011
  • Since:1997

Posted 16 March 2012 - 11:21 AM

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.

#4 COsiecki

COsiecki

    Active

  • Members
  • Pip
  • 19 posts
  • Location:San Antonio TX
  • Version:LabVIEW 2009
  • Since:2006

Posted 16 March 2012 - 01:34 PM

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.





Also tagged with one or more of these keywords: dynamic, control, intantiation, docking