LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Grey out and disable all controls at once

Is there a simple way to grey out and disable all of the controls on a FP at once?

 

Thanks,

Paul

0 Kudos
Message 1 of 10
(9,377 Views)

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...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(9,373 Views)

Yup

!0.png


"Should be" isn't "Is" -Jay
Message 3 of 10
(9,372 Views)

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.

0 Kudos
Message 4 of 10
(9,370 Views)

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).

 

 

0 Kudos
Message 5 of 10
(9,355 Views)

As other have said get the control references and disable.  I like the Traverse Objects to get the references easier.

 

Disable Controls.png

Message 6 of 10
(9,324 Views)

@JÞB wrote:

Yup

!0.png


Jeff, any benifits with merging the error lines in parallel like your example? as oppose to ...

 

Spoiler
disable all controls_BD.png

 

Message 7 of 10
(9,307 Views)

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.

0 Kudos
Message 8 of 10
(9,298 Views)

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 😄


"Should be" isn't "Is" -Jay
Message 9 of 10
(9,292 Views)

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.

 

"If you weren't supposed to push it, it wouldn't be a button."
Message 10 of 10
(9,261 Views)