10-23-2024 08:02 AM - edited 10-23-2024 08:05 AM
I have been tasked with refactoring an existing (10 year old) LabView project.
I have run into a pretty basic problem that I can't seem to solve easily: I have a bunch of subVis with a company string control that is only used to display the name of the company the application is registered to.
This value is read from a configuration file when the application starts and should never be changed during the application's execution.
Unfortunately the original application used a string control that is filled by the main vi/shell when it calls each subVi...
Since I would like to prevent users from changing this string value, I thought about turning the control into an indicator, but this clashes with the need for the calling vi to update the string value on call.
My solution is to hide the string control and add an auxiliary indicator fed by the control itself, it works but requires updating all the subvi's in both the layout and the code.
Is there a better way to solve this problem?
I'm working on LabView 2013 SP1.
Solved! Go to Solution.
10-23-2024 08:23 AM - edited 10-23-2024 08:38 AM
The simplest solution is to make the string control disabled (see the control's properties).
However it's also easy to make it an indicator and update the value via Local Variable directly.
Well I did not realize that the control is bound to the connector pane. So definitely make it disabled.
10-23-2024 08:28 AM
I would go with disabling the string control so the user cannot change and only programatically change.
Another idea is move that control out of visible FP and wire it to a string indicator and put that indicator in the visible FP.
10-23-2024 08:36 AM
> However it's also easy to make it an indicator and update the value via Local Variable.
Is it possibile to use a local variable as an input parameter for a VI itself?
10-23-2024 08:39 AM - edited 10-23-2024 08:39 AM
@michele.santucci ha scritto:
> However it's also easy to make it an indicator and update the value via Local Variable.
Is it possibile to use a local variable as an input parameter for a VI itself?
No, I'm sorry for the misunderstanding. I modified my answer above.
10-23-2024 08:59 AM
Personally, I would store the name in a Global Variable and then you can write to an indicator in all of the VIs that need to display that information.
10-23-2024 10:49 AM
@crossrulz wrote:
Personally, I would store the name in a Global Variable and then you can write to an indicator in all of the VIs that need to display that information.
You can even place that Global.vi in a library along with a private member to write the global from configuration and a public member to read the global.
10-24-2024 01:53 AM
Hallo Jay,
I tried something similar without luck. I needed to shareboard profiles data between several VIs in this project so I tought to use a shared variable Boards (an array of cluster) defined in this way:
I can access such data from every VIs but it seems that writing on this variable has no effect.
10-24-2024 06:08 AM
Not a Shared variable. Global Variable.
10-24-2024 06:44 AM
> Not a Shared variable. Global Variable.
I got it.
What's the differences? It make sense to use a shared variable within a project?