08-29-2013 08:27 AM
Hi all,
I have a Labview program which is good in function. But the code looks so mass, because there are some many variables need to be initialized. I want to change the structure or do something to reduce the variables and variable initialization. But I don't know how. Please help me to make it neat and clean or give me an example to learn.
Thanks,
Steven
Solved! Go to Solution.
08-29-2013 08:30 AM - edited 08-29-2013 08:31 AM
Hi Steven,
well, use subVIs and references to initialize controls...
Using arrays for similar controls seems a good idea, too.
Btw. I don't know the UI nor the kind of application you're working on, but "AssType" may have a different meaning for you 😄
08-29-2013 09:33 AM
Hi GerdW,
Could you give me example about how to use subVIs and references to initialize controls? Will there be a lot of references labels on this page? Thanks.
.
Using arrays for similar controls seems a good idea, too. I want to use Arrays too. But how to change the size of array to display. For instance, user one wants to test 5 items, so the first 5 items in the array should be displayed; user 2 wants to test 7 items, so the first 7 items in the array should be displayed. I don't know how to control it, so I have to control it separately. Please tell me how to do it. Thanks.
About 'AssType' thing, It is funny. I suppose to make AssemblyType in short not in funny. I will change it.
Thanks.
Steven
08-29-2013 10:29 AM
Hi Steven,
both questions can be summarized to using property nodes "the easy way":
- you can get references to all controls of a frontpanel by a property node of the frontpanel
- you can set number of visible array elements using a property node of the array. (Btw. usually this results in an ugly UI. Use table/listbox with scroll bars instead...)
08-29-2013 10:30 AM
Hi all,
I have the answer about how to user array for the similar items. Here is my question that I still no answer.
Could you give me an example about how to use subVIs and references to initialize controls, so that the code will look neat and clean?
Thanks.
Steven
08-29-2013 10:37 AM
You can use the VI method that reinitializes all FP controls.
08-29-2013 01:43 PM
Hi Paul_cardinale,
I think this is what I am looking for. I want to try this VI method things. But I don't know where I can find it.
Thank you.
Steven
08-29-2013 01:51 PM