LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Front Panel Controller SubVI?

Here is the scenario, I have a main VI that uses an event structure to call various other SubVI's depending on what control is pressed and to update the front panel accordingly.  The front panel of the Main VI is a Tab Control with ~25 controls total.  As you can imagine, some controls should not be enabled until other events happen.  For example, I have a menu ring called "Report Type" of which you can choose 'HTML' or 'Send to Printer.'  Next to this ring is a boolean control called "Open in Browser?" , I want to only enable this boolean control only when "Report Type" is set to 'HTML.'   Likewise I want both the "Report Type" and "Open in Browser?" controls to be disabled if the user has not hit the "Download Data" control to get data from the RT Controller (otherwise there would be nothing to report.) 

 

These are just a few examples of what I need to do, I have been adding 'Disabled' property nodes throughout my event cases but it is becoming very unwieldy and making my block diagram quite cluttered and hard to understand.  What I want to do is have a 'Front Panel Controller SubVI' of sorts, of which I define about 10 or so various states the front panel can be in and pass that state to the controller SubVI which in turn disables/enables controlls accordingly.  This idea sounds good but so far the implementation seems pretty bad.  I was hoping I could just make a cluster of control references and pass that into the SubVI but LabVIEW 8.2 doesn't seem to allow me to wrap up references in a cluster.  This has forced me to use VI Server to get the references.   What I've been able to come up with using VI Server works, but I can't believe its the most elegant solution.  Basically, for each of the possible states, I iterate over all the controls in the front panel and have a case structure for their Label Text which determins if that control should be enabled/disabled for the given state passed in.  Also, for some reason it seems that it is not grabbing references to ALL of my controls.  There is a menu ring control on the front panel that isn't in the Controls[] array.  I should mention that this particular Control already has a reference node created for it that gets passed to a SubVI, perhaps this is why its not found in the Controls[] array, but this doesn't seem to be very intuititve, or documetned for that matter.

 

<a href="http://tinypic.com" target="_blank"><img src="http://i37.tinypic.com/fjgwtv.gif" border="0" alt="Image and video hosting by TinyPic"></a>


0 Kudos
Message 1 of 7
(3,466 Views)

0 Kudos
Message 2 of 7
(3,464 Views)
After reading over my post, I just wanted to make it clear that I'm asking for sombody to provide a more elegant solution to this problem and I posted that image above to show what I'm currently doing, not as a tip for others or anything.

0 Kudos
Message 3 of 7
(3,453 Views)

A quick example.

You only have to make an array of the controls you want to be enabled in each state.

 

If you can group your controls in clusters in the front panel, you can disable them alltogether.

 

0 Kudos
Message 4 of 7
(3,436 Views)

Thats a very good idea, although I'd probably want to put a case structure around the disable property node and have it only change value when the search array function does *not* return -1, otherwise I'll be disabling things I might want to maintain in an enabled state.

 

Just before I read your post, another thought came to me and that why use a SubVI, I could just use a parallel loop with queues to send back state information.  Since queues can be blocking, this would not negate my event structure.  I could combine the idea you gave me with this architecture.  Thanks


0 Kudos
Message 5 of 7
(3,433 Views)
Nevermind what I said about the case structure, that just complicates things. Its much easier to just say which controls are enabled regardless if they are already enabled

0 Kudos
Message 6 of 7
(3,429 Views)
I think a state maching with user events may work for what you want to do. Here is a link to code on the developer zone that has a program for queued user events.
National Instruments
RIO Embedded Hardware PSE

CompactRIO Developers Guide
0 Kudos
Message 7 of 7
(3,389 Views)