LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Default New Control to Type Def

Hi Everyone,

 

Is there a way in the LabVIEW Development envirionment to make a newly created control start life as a Type Def.  Once I learned about type defining, I've never once gone back and created a vanilla, non-type def'd control, they are always type-def'd.  I've probably clicked that control type combo box thousands of times and would like to eliminate that step.

 

PS:  Does anyone know a good reason not to automatically type def a control?  I can't think of one, but I'm sure there is a use case somewhere.

 

Thanks,
Matt

0 Kudos
Message 1 of 7
(3,443 Views)

When you create a constant, control, or indicator you can go to block diagram and right click >> make type def. Then when you open the type def it will already be a type def but not yet saved.

 

If you want it so that when you click new >> control it comes up as a type def... I don't know how.

0 Kudos
Message 2 of 7
(3,437 Views)

Are you saying you actually want every control you drop in to become a typedef?

 

That is something I would not want.  Normal controls such as strings, numerics, booleans, I would rarely need to typedef.  Only more complicated controls such as clusters or enums would I need a typedef so that their datatype is consistent across all instances of it.  I'm going to estimate that I would need to typedef less than 10% of my controls in a given project.

 

Having any controls be a typedef that don't need to be just means creating more files that I'd have to manage.

Message 3 of 7
(3,431 Views)
The way I interpreted it is that when he actually goes to the trouble of clicking new >> control in project explorer, it is for creating a type def
0 Kudos
Message 4 of 7
(3,421 Views)

Yes, my question is for the case of file->new->control. I had forgot about the right click on the front panel of a VI trick.  Thanks for the reminder.

0 Kudos
Message 5 of 7
(3,419 Views)

Ditto what RavensFan wrote but add the special type of type def the STRCT type def for controls that will appear on a GUI.

 

? Agoo reson not to make them all type defs ?

 

You would obscure the meaning of the red coercion dot. Wiring a constant to a type indicator will give you a coercion dot to warn you the data is getting coerced from non to type-defined.

 

If every instance of that type had a red dot, it would not be long until you start to ignore the red dot.

 

Eventually that would bite you.

 

Quoting the grandmothr of an old customer...

 

"Everything in moderation, especially moderation."

 

Ben

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

@MGould wrote:

Yes, my question is for the case of file->new->control. I had forgot about the right click on the front panel of a VI trick.  Thanks for the reminder.


I did not realize that was the way you were making the control.

 

Honestly, I don't think I've ever used the New > Control menu choice.  Because if I am working on a VI and need a new special control (enum/cluster, ....)  I'll start building it right there, I'm often dragging in data from different parts of the VI.  Once I've done creating the control that way and am ready to really start using it, I go to the right click Make TypeDef.  Or in older versions of LabVIEW, used Customize Control to change the typedef status and give it a more meaningful icon.

0 Kudos
Message 7 of 7
(3,408 Views)