From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Weekly Nugget 06/29/2009

When you create a new control in the Control Editor, you have three choices for the Control Type you're creating--Control, Type Def, and Strict Type Def.  Each control type is saved as a .ctl file on disk, but there are different situations where you would choose one type over another:

 

Control - Use the Control type when you are creating a user interface element that you want to distribute to more than one VI, but that the user can customize to his liking (check out Simon's ni.com controls for examples of the Control type).  When using this type, there is no permanent linkage between the .ctl file and any instances of it on VI front panels.  That's why you should never use this type for controls/indicators/constants whose data types you want to preserve across all instances of their use.  To preserve the data type across all instances of the control, use one of the following two control types.

 

Type Def - The full name of this type is Type Definition.  Use this control type whenever you want all instances of this control/indicator/constant to always have the same data type.  For example, if you have a cluster of information that you are using throughout your application, you should make the cluster a Type Definition.  That way, if you ever need to add, remove, or change any of the elements of the cluster, you can do it in a single place (specifically, by editing the type definition's .ctl file), and have that change propogated across your entire application.  Specifically, I recommend making a type definition out ofevery cluster and every enum in your application.  Trust me...it can be very painful to go through an entire app and make manual changes to every single instance of a particular data type because somebody did not type def it.

 

Strict Type Def - The only difference between Type Definition and Strict Type Definition is cosmetic.  With a type definition, users can make pretty much any cosmetic change they wish to individual instances of the type definition within VIs.  With a strict type definition, the only things you can change are the label and the description/tip.  The important thing is that you cannot change the data type of individual instances of either type definitions or strict type definitions.  Whether you select one vs. the other is mostly a discretionary choice...I tend to use only Strict Type Definitions because it's simply the habit I've gotten into over the years.

Message 1 of 15
(7,352 Views)

I always start out with STRICT typedefs.

 

I only demote them to non-strict if I have to.

 

Cases where I have to include: enabling/disabling items within a cluster at run time and where I need one layout for front panel usage and a different one for printing. 

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 2 of 15
(7,308 Views)

I normally use Typedefs and in very little cases (pure cosmetic) I resort to strict typedefs.

 

Christina has posted a blog on customizing controls, and she mentions the difference between normal and strict typedefs.

 

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 3 of 15
(7,246 Views)

Darren points out that "The only difference between Type Definition and Strict Type Definition is cosmetic."  I'd like to emphasize that these cosmetic attributes can be quite powerful. 

 

A Strict Type Def also preserves the data input ranges which can be extremely useful.  Restricting the user input data to valid values is very nice with the data limits, but you can also validate input data from other sources (files, calculations) by obtaining the data limits via property nodes on the Strict Type Def and then using an In Range and Coerce.

 

Also, if you ever make a Ring control, you better make it a Strict Type Def!  Otherwise changing the names in one place will not appear everywhere!

 

-D

0 Kudos
Message 4 of 15
(7,164 Views)
I use Strict Type Defs all of the Time.
Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
0 Kudos
Message 5 of 15
(7,151 Views)

here is a bike strict type def. that I made for a game for fun.

 

 

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 6 of 15
(7,106 Views)
I couldn't open bikecontrol.ctl in LV 8.5.  In general, maybe save files for as early of a version as you can before posting.  Thanks...
0 Kudos
Message 7 of 15
(7,025 Views)
here is bikecontrol, saved in labview 8.0
Message Edited by Harold Timmis on 07-01-2009 08:57 AM
Message Edited by Harold Timmis on 07-01-2009 08:58 AM
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 8 of 15
(7,012 Views)

D* wrote:

 

Also, if you ever make a Ring control, you better make it a Strict Type Def!  Otherwise changing the names in one place will not appear everywhere!


Thats because a Typedef can reflect the changes made only to its (type)data in all its instances across the project. Smiley Wink

 

For a Ring control, its Index values are its (type)data & NOT its names (aka strings/items). Smiley Happy

- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 9 of 15
(6,933 Views)

K1200LT rider wrote:

In general, maybe save files for as early of a version as you can before posting.  Thanks...


It is not eoungh for me since I dont have LV as of now, I m afraid... Smiley Sad

 

Harold,

 

Can you pl post a snapshot of your Ctl file?

- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 10 of 15
(6,932 Views)