LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Faster way to enable/disable front panel objects?

Hey All,

 

I am wondering if there is a better way to handle controls while in an event structure. Here is a common scenario:

 

I have multiple controls on the front panel (buttons, slides, etc...) I use button 'A' to enter an event case that contains a while loop. What i want is for all controls EXCEPT button 'A' to be disabled, because i am using button 'A' as the while loop stop condition (as well as the event case action). Since the event case automatically disables the controls until the case has finished I go in and uncheck this, that then leaves me with a mess of property nodes so that all controls besides button 'A' are disabled. Once the user has stopped the loop by using button 'A', i again need to deal with property nodes to re-enable all of the controls on the front panel.

 

Is there a cleaner, more efficient way to handle things like this?

 

 

0 Kudos
Message 1 of 24
(6,358 Views)

I suspect others will soon reply suggesting to change your architecture to producer consumer, mast slave, QSM etc but to reply to your question as stated, you may want to concider dynamic event registration.

 

Dynamic Event registration will let you control what is regestered for events when and if you re-register an event against a constant yu can effectively shut off the event.... Asuming the user has not punched 12 controls at the same time.

 

See Ton's Nugget here.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 24
(6,351 Views)

You can write a quick sub VI that disables all controls on the calling VI's front panel, then explicity enable the ones you want.  That control reference is returned in the event structure.

 

Obligitory state machine / QMH comment.

0 Kudos
Message 3 of 24
(6,314 Views)

Wow, that dynamic event registration is really cool.  Thanks for the link to it (even though this isn't my thread). 

 

For bulk disabling controls, I created a VI that does it with references.  Pass in an array of control references and disable/enable them in an autoindexed for loop.  It cleans up the BD a lot but you still have to wire up the proper references to the VI, which could be cumbersome depending on the number of controls you have. 

aputman
Message 4 of 24
(6,301 Views)

I recently wanted to do this as well. In this .vi you can pass in an array of strings with the names of the controls that you want to enable or disable.

Download All
0 Kudos
Message 5 of 24
(6,291 Views)

aputman - that's a pretty cool icon!

0 Kudos
Message 6 of 24
(6,282 Views)

@Gregory wrote:

I recently wanted to do this as well. In this .vi you can pass in an array of strings with the names of the controls that you want to enable or disable.


I like the reference thing better.  What happens if you change the names of the controls?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 24
(6,277 Views)

Well, I think we both know the answer to that 😛 Good point though, it could be a lot of work if you change the control names!

0 Kudos
Message 8 of 24
(6,271 Views)

I usually make a typedef'd cluster of control references to do this.  That way you can add a new reference to the typedef and all instances get updated, too.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 24
(6,264 Views)

How do you get the reference into a typedef? I only know how to right click on a control and create reference.

0 Kudos
Message 10 of 24
(6,255 Views)