LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Lock constant value"

Hi,

I have a diagram with many boolean constants in it, which values are
critical. In this case, LabVIEW feature to easily change a boolean
constant value by a simple mouse click is a dangerous source of errors.

Is there a way to "Lock constant value" in LabVIEW ?

Is there any other handy way to shortcut this problem ?

ozimmer@isn.in2p3.fr
0 Kudos
Message 1 of 6
(3,386 Views)
Put all your constants into cluster, change it to control, make it's value as default and hide it. In diagram simply read values from it.
0 Kudos
Message 2 of 6
(3,386 Views)
hi Olivier,

a possible solution might be not to use constants in Diagram, but Controls on Frontpanel - combined into
a cluster - make then current values default - and then hide this cluster on frontpanel; in this way you cannot change values by accident in your Diagram......

is this acceptable ?

regards
wha
0 Kudos
Message 3 of 6
(3,386 Views)
Hi,
if you absolutely have to have a difficult to edit item, the best way is to make it a control, set off to either one side of the panel where it cannot be seen when the software is running, or set it to invisible.

Another option (again requireing the front panel) is to put down a numeric, and set it's data range Max and Min to the same, and put the increment to 0.0. - that way when you do need to change it, you can by going back in and editing the data range, but it's no longer a simple case of clicking on the item. It's a simple matter to take a 0 / 1 and turn it into a boolean (compare it to a 0 / 1!)

Another, more complicated way, is to use the configuration .vi's to load in the constants from a .ini file.

You could also put a free label with a transp
arent background over the top of the constant. (easiest) Makes it more obvious what the constant is for, and stops the designer having the ability to directly click on it.

Finally (and not recommended) is to use a PI constant, and another constant to represent the boolean (again comparing to get the True/False. The reason I don't recommend this is the block diagram can become confusing - why use a PI constant is bound to be asked by the first person to look at it!


I agree, lock constant value would be a nice feature for a future version of LV though.

Hope that helps

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 4 of 6
(3,386 Views)
If you have a diagram that you don't want users to change, then password protect the VI, lock it (slows them down some), save it under a different name without diagram, or create an executable. Changing a "constant" is no worse than a user modifying any other part of the program and making them a invisible front panel object is not really addressing the problem and just makes a program harder to maintain for the next person. If you're worried about you accidently making some change, make sure your program is documented and then use some source code control system.
0 Kudos
Message 5 of 6
(3,386 Views)
> Is there any other handy way to shortcut this problem ?
>

Another solution that wasn't mentioned, is to select the constants and
the array builder or cluster and make a subVI. You can give the subVI a
good icon. This makes it very easy to access from different locations.

Greg McKaskle
0 Kudos
Message 6 of 6
(3,386 Views)