09-03-2013 02:23 PM - edited 09-03-2013 02:24 PM
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,
Solved! Go to Solution.
09-03-2013 02:37 PM
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.
09-03-2013 03:11 PM
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.
09-03-2013 04:32 PM
@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?
09-03-2013 04:40 PM
@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.
09-03-2013 04:45 PM
@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.
09-03-2013 04:51 PM
@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!
09-04-2013 07:00 AM
@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
09-04-2013 07:46 AM
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
09-04-2013 10:59 AM
Here is quick example of disable/enable of all controls inside a cluster (v2009).