02-02-2007 12:51 AM
02-02-2007 02:07 AM - edited 02-02-2007 02:07 AM
Hi Jamie,
You're describing a "typedef"
After you create the cluster, select it and, while it's selected, choose Edit\Customize control. When the control editor opens, change the "typedef status" pull-down-menu from "Control" to Type Def. - then File\save. Whenever you need a copy of the control, right-click on the front-panel (or diagram) and select the ".ctl" file you saved. Now all the copies will be updated by changing the (one) typedef. ![]()
Cheers!
Message Edited by tbd on 02-02-2007 02:08 AM
02-14-2007 08:52 PM
02-15-2007 12:26 AM - edited 02-15-2007 12:26 AM
When I load the VI, cluster A's elements are all set to 0 instead of my default values. Also, if I change the values and save the VI, the cluster's values get reset to 0.
After opening the VI, set your desired values in cluster-A then right-click on the border of cluster-A and select "Make current values default". Close the VI and open it again - the default values should be there. If not, please post your VI! ![]()
Note: there's a bug in LabVIEW (at least in 6.1 and 7.1) related to setting a default-value for clusters! If the cluster type-def is changed, "default" cluster values can be corrupted! For this reason, I'd advise against using default values with typed-clusters. ![]()
Another bit of strange behaviour I noticed was when I right click on the control in the VI front panel, there is the option to open the typedef. However, if I have already opened the typedef for the other cluster control, then the option is no longer available.
This is normal! We're only allowed to edit one type-def "thread" at a time. You'll eventually notice that if a "parent" cluster type-def contains a "child" type-def, then we are allowed to open/edit one child at a time. This brings-up another quirk associated with type-defs. If you open/edit a child type-def independently of a parent type-def, the parent may become broken until opened and saved. ![]()
I don't know what's going-on with the asterisk!
Hope it helps!
Message Edited by Dr.Ivel on 02-15-2007 12:27 AM
02-15-2007 03:56 AM
The default data is associated with the VI not with the typedef. You usually don't want the default data to change in all VIs when you make modifications to the typedef. But as Dr. Ivel said there has been a bug in older LabVIEW versions where modifying the cluster typedef made all controls loose their default data and return to LabVIEW's default default data. Means they revert to empty strings, 0 for numbers, etc.
@Jamieg wrote:
Thanks tbd,
I have create 2 typedef controls for 2 different clusters I have.
However, one of them has undesirable behaviour and I don't know why.
When I load the VI, cluster A's elements are all set to 0 instead of my default values. Also, if I change the values and save the VI, the cluster's values get reset to 0. In the saved control the cluster has the desired default values so this isn't the problem's cause.
Also, the VI now always has an asterix in the title bar, usually indicating changes have been made since the last save. However, even after I click save, the asterix is still there.
On the other hand, cluster B has my desired qualities where it remembers default values and loads to them.
How can I fix cluster A?
Regards,
Jamie
PS
Another bit of strange behaviour I noticed was when I right click on the control in the VI front panel, there is the option to open the typedef. However, if I have already opened the typedef for the other cluster control, then the option is no longer available.
03-01-2007 12:22 AM
03-01-2007 07:49 AM - edited 03-01-2007 07:49 AM
I feel like Oliver Twist asking for "more" when I post counter to Rolf but here goes.... ![]()
The loss of the defaults fo a type-def'd constants on the diagram is "by design" and not a bug.
There is a check in the VI Analyzer that looks for type-def'd constants that are NOT the default and warns you if it find them.
I would prefer the "design" be different than it is but....
The proper way to do this is to use "Bundle by name" to set the non-default values as required. You can put this in a sub-VI and re-use that set of settings if need be.
Ben
PS : please forgive me Rolf! ![]()
Message Edited by Ben on 03-01-2007 07:50 AM
03-03-2007 01:31 AM