05-17-2017 11:27 AM
Hello everyone.
I am working on project for developing RF- measurement system. my code working very fine. but there is one of the cases in the case structure I feel it became mess of wires specially from stuff related to controls disable and enable property node as shown in the attached picture. and I have a VI in that case very very important to do the generators setting for different harmonics so the controls going to it to many as shown in the same picture. I asking if there is another I can do to simplify this code without effecting its work. I wish if there is one of you could help me. I will be really appreciated.
Solved! Go to Solution.
05-17-2017 11:36 AM - edited 05-17-2017 11:39 AM
Hi thoalfukar,
instead of using a lot of single property nodes you could use an array of control references and a FOR loop to set them dis-/enabled…
Personal opinion:
I don't like VIs where the labels of property nodes and control terminals are ALL hidden! Such behaviour makes it hard to understand the block diagram of such VIs…
Maybe there's a reason to obfuscate your code but how can you tell WHICH controls are en-/disabled?
05-17-2017 11:54 AM
Pass the array of references to a subVI and enable/disable them there, so that the code can be reused. I don't use the disabled option because IMO, it's not disabled unless it's grayed out. But that is a personal preference.
05-17-2017 12:20 PM
Thanks for your kind reply,
regarding to the question, I know which controls should be enabled and which should be disabled in this case.
Regarding to your solution, many thanks it is a good idea i didn't think about it, but If I use array of reference I need to build that array and to build it I need very long list of references which end up with the same problem!
Regards
Thoalfukar Husseini
05-17-2017 12:26 PM - edited 05-17-2017 12:27 PM
@thoalfukar wrote:
Thanks for your kind reply,
regarding to the question, I know which controls should be enabled and which should be disabled in this case.
Regarding to your solution, many thanks it is a good idea i didn't think about it, but If I use array of reference I need to build that array and to build it I need very long list of references which end up with the same problem!
Regards
Thoalfukar Husseini
You may know which controls, now, because you're working on it. But will you know a year or two from now when you revisit this code? Or if someone else (like someone on the forums helping you) know which of those nodes goes to which node? No.
If you were programming in a text based language, would you name all your variables A, B, C, D, E,.... or give them a more meaningful, descriptive name?
05-17-2017 12:34 PM
@thoalfukar wrote:
Thanks for your kind reply,
regarding to the question, I know which controls should be enabled and which should be disabled in this case.
Regarding to your solution, many thanks it is a good idea i didn't think about it, but If I use array of reference I need to build that array and to build it I need very long list of references which end up with the same problem!
Regards
Thoalfukar Husseini
See here where I posted about a GUI controller that allows me to touch the GUI from a sub-VI.
Back in the day...
Of LV 5.1 there where no property nodes but rather attribute nodes that HAD to be located on the diagram of the VI that contained the controls. large applications with any degree of enhanced look and feel where huge! I swear that the ugliest diagrams you see posted by NI as examples of bad code where developed in LV 5.1 or earlier.
I was very excited when I learned that using property nodes in a sub-VI was possible because it let me push down dirty little distracting details into sub-VI where they belonged.
Ben
05-18-2017 03:35 AM
hi,
could you tell me how you generate the array of references ?
do you run the vi and then change it to control
05-18-2017 04:01 AM