11-04-2008 12:27 PM
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>
11-04-2008 12:29 PM
11-04-2008 12:50 PM
11-04-2008 01:36 PM
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.
11-04-2008 01:46 PM
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
11-04-2008 01:58 PM
11-05-2008 11:27 AM