LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I change the numeric and enum default values in a Strict Type Def Cluster?

Solved!
Go to solution

I have a Strict Type Def cluster that contains 10 Numerical controls and a number of enums.  I have edited default values of the numerical controls in the Strict Type Def, in customize mode, performed a "Make Current Values Default"  and have done a "Apply Changes"  and saved.

 

This cluster is used in various locations throughout the project and have not found a way to make the cluster default values change downstream.  The Strict Type Def (STD) Control appears to have the right values on the front panel.  But if I place an instance of this on a blank front panel, and run a wire from it in the block diagram with a probe and indicator, I still get the old default values being passed from the STD.  

 

 

0 Kudos
Message 1 of 8
(2,321 Views)

A typedef (strict or regular) only defines the type, not the data. The default value that you set in the typedef would only be used when you create a new instance of the control since it's simply using it as a starting point. Existing instances would not be affected by changes in the default value in the typedef.

0 Kudos
Message 2 of 8
(2,313 Views)

After changing the StrTypDef default values, even new instances of the control are passing the old default values.   That is the problem.

 

Every control in the cluster has a default value.  Can that default value be non-zero, and be passed to the downstream vis if that StrTypDef is instantiated on their block diagrams?

0 Kudos
Message 3 of 8
(2,309 Views)

@TEST_GF wrote:

After changing the StrTypDef default values, even new instances of the control are passing the old default values.   That is the problem.


I do not understand what you mean. What do you mean by "passing the old default values"? If you place a new instance of the control on the front panel, what are the numerics set to? Are you sure you're placing the typedef, and not the control that is in the Control Editor window?

 


 Every control in the cluster has a default value.  Can that default value be non-zero, and be passed to the downstream vis if that StrTypDef is instantiated on their block diagrams?

Yes, the default value can be non-zero. But as I said, the typedef does not control the values. It's not supposed to. You have to explicitly set the values whether you use it as a control or as a block diagram constant. This is by design.

0 Kudos
Message 4 of 8
(2,306 Views)

My main GUI has an indicator that ranges from -120 to -20.  I initially updated the indicator to have a default value of -120, which is desired.  I also then modified the constants to have the desired defaults on that block diagram, which were made from the StrictTypDef in question. 

 

It occurred to me that regardless of the default values in the strictTypDef, main GUI would always receive a 0 value. This agrees with what you are telling me about TypDefs not passing data.  I am trying to find a way to make that value default to -120, or the bottom of the scale, rather than off-scale in the positive direction.

 

Any other suggestions?

0 Kudos
Message 5 of 8
(2,298 Views)
Highlighted

There Are No Strict Type Definition Constants

 

"Even though typedefs only update when types change, instances get cosmetic changes from the definition whenever they update. So one trick to "push" changes to typedef instances is to change the data type, apply changes, and then change the data type back. [edit, March 26 - Note that the typedef instances need to be in memory when you use this trick]."

From Eyes on VIs, here.

http://blog.eyesonvis.com/

 

I love this article.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 6 of 8
(2,285 Views)
Solution
Accepted by TEST_GF

and yet another approach is mentioned in my Nugget on Type definitions found here, where I include this image

 

 

To ilustrate how a wrapper around the type-def constant not only avoids the "explostion problem" (largly fixed by new feature in LV 2011 to view as an icon) can be used to define default values AND allow some documentation to explain what where and why.

 

Ben

Message 7 of 8
(2,275 Views)

The method shown by Ben is a tried-and-true method and is as such for good reasons. I use the same approach for the pseudo-classes (still running 8.2, where classes are buggy) I have for the instruments in the test exec here at work.

0 Kudos
Message 8 of 8
(2,269 Views)