04-26-2016 03:05 AM
Hello Fellow Labviewers,
I have an event driven state machine and use a reference cluster of some 40 odd elements to carry values of user operated booleans, strings, numbers, pictures, etc. through the state machine. However, initializing the cluster with all the references of controls and indicators in the program looks rather tacky on the block diagram. (see below) Any creative ideas/suggestions on reducing this tower of reference initialization?
Thank you kindly!
04-26-2016 03:53 AM
@cwatanabe92 wrote:However, initializing the cluster with all the references of controls and indicators in the program looks rather tacky on the block diagram. (see below)
Thank you kindly!
Hi,
If you want to intialize the element in the cluster just right click on the cluster go to create ---> invoke node ---> reinitialize to default.
using this method all the value of cluster will be reinitialized to default. you can just pass the cluster input.
Hope this helps
Kudos Welcome 🙂
04-26-2016 04:05 AM - edited 04-26-2016 04:25 AM
I'd recommend to use variant and operate on control name:
04-26-2016 05:52 AM
@cwatanabe92 wrote:I have an event driven state machine and use a reference cluster of some 40 odd elements to carry values of user operated booleans, strings, numbers, pictures, etc. through the state machine.
Why use the references? Why can't you just use the terminals to get the values and local variable to write them? It would be more efficient than using property nodes.
04-26-2016 05:54 AM
I believe it's more convinient when you want to enable/disable different controls or just changing their's properties...
04-26-2016 06:01 AM
@AdamTrojak wrote:I believe it's more convinient when you want to enable/disable different controls or just changing their's properties...
The OP specifically stated uses the references to carry the values. That was the point of my comment. Yes, it does make it much easier when you start dealing with enable/disable etc. But purely for the values, references is a path best not taken.
04-26-2016 06:04 AM
Oh, yes, I din't noticed that. In that case references are pointless
04-26-2016 10:40 AM
I have been asked to rewrite an application written in another lnaguage such that the GUI had to be identicle to the original. That required multiple nest tabs with hundreds of controls. I resorted to using a state machine that bundled all of the control from each tabe into a single cluster. That cluster was then used in a GUI controller that took care of all of the viability/disable/enable work using multiple sub-VI each with their own dynamically registered even structure.
While that approach is not used by many, it worked to make the code easy to understand by my customer who very quickly was able to take over maintaining the code himself.
Just offering another idea...
Ben
05-20-2016 02:49 AM
Interesting! Looks really clean. In this case then, instead of having a cluster that references all of the controls and carrying that through the state system, we have a variant array that we can use to carry information about the controls through the system, and changing values/parameters of controls is as easy as indexing the control in the variant and changing the value of that control?
05-20-2016 02:50 AM
I should have been more specific, my apologies. I also use the reference cluster to control multiple properties of the controls in the program.