03-04-2019 12:56 AM - edited 03-04-2019 01:03 AM
Hi,
I am working on a function that after entering the password, some items will change from "Disable and gray out" to "Enable".
The problem is, when there are many items, I'll have to create property nodes for each of them. As picture below.
It takes a lot of time and also make the block diagram a mess.
Is there any more efficient way to do this work?
Solved! Go to Solution.
03-04-2019 01:28 AM
How about using Control reference and using the Same on need basis for Enable and Disable in a Loop for same type?
03-04-2019 01:28 AM
You can iterate over multiple controls or indicators via Front Panel->All Objects[] Property Node.
For example, somethijng like that:
03-04-2019 01:29 AM - edited 03-04-2019 01:29 AM
Hi Ian,
Is there any more efficient way to do this work?
Well in nearly every programming language this rule is true:
When you want to repeat the same operation multiple times you should place that operation in a loop!
With LabVIEW you alos get autoindexing loop, that run very efficiently on array inputs…
03-04-2019 02:20 AM
Hi,
I have tried Andrey's sample code and it's working great, thanks a lot!
But can I change the specific items in this way?
For example, if I'm going to change the setting for Boolean 1-3 but not Boolean 4-6, is it possible?
03-04-2019 02:30 AM
03-04-2019 03:26 AM
Hi GerdW,
It's exactly what I'm looking for, really appreciate it!
Enclosed my code if anyone may need it in the future ![]()
03-04-2019 06:34 AM
Place them in a Cluster and disable/enable the cluster. 🙂
/Y
03-04-2019 09:21 AM
Put the disabled control outside of the loop and wire in the value. Just nitpicking.
If your code only ever accesses the same controls, you can cache the control references on first execution to speed things up a little.
If you do things in a sub-VI, the caching can still be done if you choose "Re-entrant - preallocated clones". And here, if all the VI does is write to property nodes, you might also shave off some time by setting the execution thread of the sub-VI to "UI Thread".