NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
TEST_GF
Posts: 5
0 Kudos
Accepted Solution

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

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.  

 

 

Knight of NI
Posts: 18,064
0 Kudos

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

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.

Member
TEST_GF
Posts: 5
0 Kudos

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

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?

Knight of NI
Posts: 18,064
0 Kudos

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

[ Edited ]

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.

Member
TEST_GF
Posts: 5
0 Kudos

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

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?

Active Participant
jcarmody
Posts: 1,561
0 Kudos

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

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
CLD
Knight of NI
Knight of NI
Ben
Posts: 16,091

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

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

Ben Rayner
Who is NOT John Galt... yet... just building Rayner's Ridge

Knight of NI
Posts: 18,064
0 Kudos

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

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.

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page