04-29-2016 12:10 PM
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
04-29-2016 12:20 PM
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.
04-29-2016 12:26 PM
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.
04-29-2016 12:31 PM
04-29-2016 12:32 PM
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.
04-29-2016 12:35 PM
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
04-29-2016 12:55 PM
@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.