LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Readonly controls

Solved!
Go to solution

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.

0 Kudos
Message 1 of 13
(488 Views)
Solution
Accepted by michele.santucci

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.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 2 of 13
(462 Views)

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.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 3 of 13
(455 Views)

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?

0 Kudos
Message 4 of 13
(440 Views)

@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.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 5 of 13
(434 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 13
(413 Views)

@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.


"Should be" isn't "Is" -Jay
Message 7 of 13
(381 Views)

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:

 

michelesantucci_0-1729752755247.png

I can access such data from every VIs but it seems that writing on this variable has no effect.

 

 

 

0 Kudos
Message 8 of 13
(313 Views)

Not a Shared variable. Global Variable.

Yamaeda_0-1729768110624.png

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 9 of 13
(297 Views)

Not a Shared variable. Global Variable.

I got it.

What's the differences? It make sense to use a shared variable within a project?

0 Kudos
Message 10 of 13
(288 Views)