12-10-2008 09:06 AM
I am looking for some verification on Type Defs, and more specifically Strict Type Defs.
I inherited some code, which I need to maintain. It has Strict Type Defs. I had to go back to my basics manual to remember how they worked, and was confused for a time, and came here. I think I have sorted it out now, but if someone can back me up, I would appreciate it.
A strict type def is a control, and you can place an instance of this control in several VIs, but each will be an separate of each other instance of the same type def, when it comes to the values of it.
The reason I ask this, is the project I am maintaining has a strict type def in two VIs. The type def, MasterSelector.ctl, is a cluster of booleans, which in each VI is being read from, and then written to via property nodes. There is one instance of it in the MasterSelectorSwitch.vi and VTVMSelectorSwitch.vi. When the MasterSelector.ctl is changed in MasterSelectorSwitch.vi, it makes no changes in the VTVMSelectorSwitch.vi. It isn't persistant over VIs. If I wanted the type def to be persistant over many different VIs, I would put it in the Global.vi. That is the only way to make the changes persistant over the VIs.
Is this the correct behavior of the Type Defs?
Thanks,Brian
Solved! Go to Solution.
12-10-2008 09:18 AM
Brian,
you have to differentiate between three possible setttings for the costumization of controls:
a) Custom Control: A template on how a control will look like. This makes only sense for customizing visual components of frontpanel objects.
b) Type Definition: This defines the general layout of data used in the application. Type definitions are usually used with clusters and enum controls. So this is kind of a template for data elements (used on frontpanels and block diagrams).
c) Strict Type Definition: This adds a visual definition to the Type Definition. So if you choose a cluster as strict type definition, you cannot change the visual appearance for controls instanciated from those type definitions.
hope this helps,
Norbert
12-10-2008 09:45 AM
Norbert,
The customized control which I am referring to in the post is always the strict type definition, although I don't always say it.
Also, I have run the VIs, so I can know what is going on. I have the strict type definition on the front panel, and when the property nodes are writing to the boolean indicator, it does change: on or off according to the value. Is this what you mean by can't change the appearance of the control? Because the "light" goes on and off, in each of the two VIs with the Strict Type Definition.
But mostly my question came from the persistance (or is it persistence? too lazy to check it out right now) of the value written. In this strict type definition, it is a cluster of 24 different booleans. Only one can be "on" at a time. If I turn one on in the MasterSelectorSwitch.vi, will it change the value in the VTVMSelectorSwitch.vi? It looks like it doesn't, and according what I have been reading, it shouldn't. They are completely separate instances in the two different VIs. This is what I want to verify. I am testing this in LV8.5 and will actually run it in LV8.0. I didn't have 8.0 for my desktop at the time I started playing with this, and don't want to redo my work at this time to make it work in 8.0 yet. I appreciate your help.
Thanks,
Brian
12-10-2008 10:05 AM
Brian,
could you please post your example including the type def?
What i meant by "can't change the appearance of the control" is that the control can only change its values; properties like color, size and formation are defined by the strict type definition and cannot be changed for the instances; using (weak) type defs, you could....
Each instance could have different values though. Therefore, type definitions and customized controls cannot be used to transfer data!
hope this helps,
Norbert
12-10-2008 10:33 AM
A custom control (be it custom, type def., or strict type def.) will NOT be persistant, as you put it. Each instance will use it's own values and the values must be passed through normal methods, wires, local variables, etc.
Type defs are usually used to preserve the TYPE of data a control holds, but not the actual value.
Hope this helps.
12-10-2008 12:21 PM
Norbert, Steven,
Thanks for verifying my question. At first, I was thinking that the values would be the same from instance to instance. Then I changed my mind. And then i was confused. But I am clear now.
I could post an example, but my question has been answered. It is solved, by what you both have said. Let me know if you would still like to see the example.
Thanks again,
Brian