10-30-2013 10:02 AM
Is there a simple way to grey out and disable all of the controls on a FP at once?
Thanks,
Paul
10-30-2013 10:13 AM
Hi Paul,
get references for the FP controls (that's a property of the VI) and go into a FOR loop to disable them one by one. Use DeferPanelUpdate to speed this step up...
Why do you need to disable ALL controls? Sometimes it might be easier to place controls on different tabs of a tab container and then to switch to a different tab programmatically to prevent the user from playing with any inputs...
10-30-2013 10:15 AM
10-30-2013 10:16 AM
Not really.
You will have to iterate through an array of control references in a For Loop to disable/grey each one. The trick is to get the arrya of control references. This could be from using the Control{[] property of the Pane object.
You could also manually build an array of all the control references for each of the front panel objects you want to control.
10-30-2013 10:35 AM
Here is one way to grey out a disable all at once, but not directly. Place everything in a cluster control on the front panel (mess with the appearnace so it's not actually visible). Then you can just disable/grey out the cluster (applying the same effect to everything inside).
10-30-2013 02:15 PM
As other have said get the control references and disable. I like the Traverse Objects to get the references easier.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
10-30-2013 03:00 PM
10-30-2013 03:23 PM
Is it even necessary to have the Close Reference functions on this? I thought this is one of those cases where the references are already in existence because the controls are in the VI, and they would be self closing when the VI leaves memory.
10-30-2013 03:51 PM
Apok, Bill
Its merely a style issue. No specific benefit. Bill is absolutly right that these refs will be cleaned up without the close ref. In fact, In theory if the Panes[] PN returns an error the loop will not iterate and all of the lower three errors are identical. So WHY? because, the guy in the next cube may be working with property nodes of some other class. Almost garunteed to be interfacing to some .NET assembly written by the maestro of poor programming practice, known affectionatly to us as "The manager". Now I have to explain to him/her why your adaptation blows up but my code is safe and maybe, even point out that the richly obfuscated assembly from the manager was concieved with all the talent our worst intern could have outcoded in diapers. Now they are confussed and remember that my code doen't follow the standard I enforce on them "Just because I think I'm Mr. LabVIEW Trivia buff." So, the coworkers begin to hate me just a little and, the manager thinks I hate them (I might but, I woudn't want them to think so.)
I guess that actually is a specific benefit 😄
10-30-2013 06:41 PM
Place all the controls onto a 1-page tab control. Adjust the size/position of the tab control so its edges are outside the bounds of the front panel window.
Now you can use the 'Disabled' property of the tab control to gray-out all the controls at once.
This is better than using a cluster because the controls still have individual terminals on the block diagram.