LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What are type defs used for?

I am learning about type defs and wanted to ping the community to get a feel for what expanse of things they are useful for.  Any and all comments are welcome.

Cheers!
0 Kudos
Message 1 of 8
(3,498 Views)
If you have a bunch of VIs that use a common control, a Strict Type Def will allow you to do mass edits.  Just edit and save the strict typedef, and the next time the VIs are brought into memory they will auto update their controls to match the changed typedef.
Message 2 of 8
(3,495 Views)

Please see my Typedef Nugget to get you started.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 8
(3,493 Views)
Thank you Ben, this is precisely what I was looking for!

Cheers
0 Kudos
Message 4 of 8
(3,488 Views)
How do Type Defs play into the new StateChart module for 8.5?

Cheers!
0 Kudos
Message 5 of 8
(3,470 Views)
I mainly use typdefs for as a data types in messaging systems.
I think the StateChartModule can have similar approach.

One follow up question:
I have never 'really' grasped the diff between strict type defs and typedefs. The first give me mainly headaches so I never use them.
Can someone enlighten me?

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 8
(3,434 Views)

Ton


I have never 'really' grasped the diff between strict type defs and typedefs. The first give me mainly headaches so I never use them.
Can someone enlighten me?


As I understand them and use them, Strict typedefs allow you to dictate the appearence as well as the data definitions.

They are useful if you want to make sure that every user interface that presents a cotrol or indicator all appear the same. An example would be a wizard interafce where you walk the user through completing a form. By use a strict typedef all FP instance will always look the same. The strctness does NOT apply to diagram constants, etc.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 8
(3,423 Views)

I found this (from LV Help) enlightening as to the differences between typedefs and strict typedefs:

Type Definitions and Strict Type Definitions

Use type definitions and strict type definitions to link all the instances of a custom control or indicator to a saved custom control or indicator file. You can make changes to all instances of the custom control or indicator by editing only the saved custom control or indicator file, which is valuable if you use the same custom control or indicator in several VIs.

Type Definitions

Type definitions identify the correct data type for each instance of a custom control or indicator. When the data type of a type definition changes, all instances of the type definition automatically update. In other words, the data type of the instances of the type definition change in each VI where the type definition is used. However, because type definitions identify only the data type, only the values that are part of the data type update. For example, on numeric controls, the data range is not part of the data type. Therefore, type definitions for numeric controls do not define the data range for the instances of the type definitions. Also, because the item names in ring controls do not define the data type, changes to ring control item names in a type definition do not change the item names in instances of the type definition. However, if you change the item names in the type definition for an enumerated type control, the instances update because the item names are part of the data type. An instance of a type definition can have its own unique label, description, default value, size, color, or style of control or indicator, such as a knob instead of a slide.

If you change the data type in a type definition, LabVIEW converts the old default value in instances of the type definition to the new data type, if possible. LabVIEW cannot preserve the instance default value if the data type changes to an incompatible type, such as replacing a numeric control or indicator with a string control or indicator. When the data type of a type definition changes to a data type incompatible with the previous type definition, LabVIEW sets the default value of instances to the default value for the new data type. For example, if you change a type definition from a numeric to a string type, LabVIEW replaces any default values associated with the old numeric data type with empty strings.

Strict Type Definitions

A strict type definition forces everything about an instance to be identical to the strict type definition, except the label, description, and default value. As with type definitions, the data type of a strict type definition remains the same everywhere you use the strict type definition. Strict type definitions also define other values, such as range checking on numeric controls and the item names in ring controls. The only VI Server properties available for strict type definitions are those that affect the appearance of the control or indicator, such as Visible, Disabled, Key Focus, Blinking, Position, and Bounds.

You cannot prevent an instance of a strict type definition from automatically updating unless you remove the link between the instance and the strict type definition.

----------------------------------
LabVIEW 8.0.1; WinDoze XP
aut viam inveniam aut faciam
0 Kudos
Message 8 of 8
(3,403 Views)