03-13-2012 01:37 PM
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.
Solved! Go to Solution.
03-13-2012 02:28 PM
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.
03-13-2012 02:50 PM
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?
03-13-2012 02:57 PM - edited 03-13-2012 02:58 PM
@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.
03-13-2012 03:30 PM
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?
03-14-2012 04:57 AM
"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.
I love this article.
03-14-2012 07:57 AM
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
03-14-2012 08:05 AM
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.