LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable front panel controls Programmatically

Solved!
Go to solution

Hi  All,

 

I have a case in which I need to disable the front panel control during scanning or taking data and enable when that case is false/ when not taking data. I try to make the subvi usng vi reference, property node , seaching the label of the controls  and disbaling it. I want disable all the control listed in the array during true case and enable them back for false case.But as of now  its not working and hangs my main program.Please see the attached vi and help in finding where I am doing wrong.

 

 

 

Thanks,

0 Kudos
Message 1 of 14
(7,476 Views)

You want to make a cluster of front panel control refs and pass this into your subvi.  Unbundle it inside and create "disable" property nodes for each.

 

BONUS POINTS:

Make a typedef out of that cluster before using it anywhere so as you add controls to it, all your clusters will update automatically and you won't have any broken VIs.

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 2 of 14
(7,469 Views)
Solution
Accepted by topic author AnkitG

The better way would be to create an array of references to the controls you want to mess with beforehand.  I say this since I'm guessing you have several groups of controls you will enable/disable at the same time.  If you have an array of these controls already created, then you just have to run the array into a FOR loop and use the Disable property.  I made some slight cleanups to your current VI.  I got rid of the outermost case structure since both cases are basically doing the same thing.  Use a Select function to choose to enable or disable.

 

NOTE: forums are screwing up again and not letting me post a VI.  Change the extension back to vi to open it in LabVIEW.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 14
(7,440 Views)

@crossrulz wrote:

The better way would be to create an array of references to the controls you want to mess with beforehand.  I say this since I'm guessing you have several groups of controls you will enable/disable at the same time.  If you have an array of these controls already created, then you just have to run the array into a FOR loop and use the Disable property.  I made some slight cleanups to your current VI.  I got rid of the outermost case structure since both cases are basically doing the same thing.  Use a Select function to choose to enable or disable.

 

NOTE: forums are screwing up again and not letting me post a VI.  Change the extension back to vi to open it in LabVIEW.


I don't like the way it is dependent on the strings being correct.  Is there a better way using an array of references?

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 4 of 14
(7,417 Views)

@billko wrote:

@crossrulz wrote:

The better way would be to create an array of references to the controls you want to mess with beforehand.  I say this since I'm guessing you have several groups of controls you will enable/disable at the same time.  If you have an array of these controls already created, then you just have to run the array into a FOR loop and use the Disable property.  I made some slight cleanups to your current VI.  I got rid of the outermost case structure since both cases are basically doing the same thing.  Use a Select function to choose to enable or disable.

 

NOTE: forums are screwing up again and not letting me post a VI.  Change the extension back to vi to open it in LabVIEW.


I don't like the way it is dependent on the strings being correct.  Is there a better way using an array of references?


I typically create an array of references using a bunch of references to the controls I care about and the Build Array.  I can then use that array to enable/disable, make visible/not visible, initialize data, etc inside of a FOR loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 14
(7,412 Views)

@crossrulz wrote:

@billko wrote:

@crossrulz wrote:

The better way would be to create an array of references to the controls you want to mess with beforehand.  I say this since I'm guessing you have several groups of controls you will enable/disable at the same time.  If you have an array of these controls already created, then you just have to run the array into a FOR loop and use the Disable property.  I made some slight cleanups to your current VI.  I got rid of the outermost case structure since both cases are basically doing the same thing.  Use a Select function to choose to enable or disable.

 

NOTE: forums are screwing up again and not letting me post a VI.  Change the extension back to vi to open it in LabVIEW.


I don't like the way it is dependent on the strings being correct.  Is there a better way using an array of references?


I typically create an array of references using a bunch of references to the controls I care about and the Build Array.  I can then use that array to enable/disable, make visible/not visible, initialize data, etc inside of a FOR loop.


I think I get it.  Instead of using the strings to parse the label of each control to enable or disable it, you would simply wire a disable property node inside the for loop?

The more I learn about LabVIEW, the more I learn I only know the tip of the iceberg.

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 6 of 14
(7,406 Views)

@billko wrote:

@crossrulz wrote:

@billko wrote:

@crossrulz wrote:

The better way would be to create an array of references to the controls you want to mess with beforehand.  I say this since I'm guessing you have several groups of controls you will enable/disable at the same time.  If you have an array of these controls already created, then you just have to run the array into a FOR loop and use the Disable property.  I made some slight cleanups to your current VI.  I got rid of the outermost case structure since both cases are basically doing the same thing.  Use a Select function to choose to enable or disable.

 

NOTE: forums are screwing up again and not letting me post a VI.  Change the extension back to vi to open it in LabVIEW.


I don't like the way it is dependent on the strings being correct.  Is there a better way using an array of references?


I typically create an array of references using a bunch of references to the controls I care about and the Build Array.  I can then use that array to enable/disable, make visible/not visible, initialize data, etc inside of a FOR loop.


I think I get it.  Instead of using the strings to parse the label of each control to enable or disable it, you would simply wire a disable property node inside the for loop?

The more I learn about LabVIEW, the more I learn I only know the tip of the iceberg.


Haha, that was too simple.  🙂

 

Thanks for the timely tip, Cross!

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 14
(7,404 Views)

@billko wrote:

@billko wrote:

@crossrulz wrote:

@billko wrote:

@crossrulz wrote:

The better way would be to create an array of references to the controls you want to mess with beforehand.  I say this since I'm guessing you have several groups of controls you will enable/disable at the same time.  If you have an array of these controls already created, then you just have to run the array into a FOR loop and use the Disable property.  I made some slight cleanups to your current VI.  I got rid of the outermost case structure since both cases are basically doing the same thing.  Use a Select function to choose to enable or disable.

 

NOTE: forums are screwing up again and not letting me post a VI.  Change the extension back to vi to open it in LabVIEW.


I don't like the way it is dependent on the strings being correct.  Is there a better way using an array of references?


I typically create an array of references using a bunch of references to the controls I care about and the Build Array.  I can then use that array to enable/disable, make visible/not visible, initialize data, etc inside of a FOR loop.


I think I get it.  Instead of using the strings to parse the label of each control to enable or disable it, you would simply wire a disable property node inside the for loop?

The more I learn about LabVIEW, the more I learn I only know the tip of the iceberg.


Haha, that was too simple.  🙂

 

Thanks for the timely tip, Cross!


Thank you very much crossrulz and billko for your suggestions and for the cleanup of my vi., I will try to implement the control refrence and also try the modified vi you posted.

 

Thank you very much

0 Kudos
Message 8 of 14
(7,371 Views)

Hi all,

 

 

Is there an example for how to handle control reference , I am little confused about how to use them in my program. attached is my cluster of all the controls, please let me know how can I improve or make it right.

 

Thanks again

0 Kudos
Message 9 of 14
(7,359 Views)

Here is quick example of disable/enable of all controls inside a cluster (v2009).

0 Kudos
Message 10 of 14
(7,331 Views)