LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronize enum's across VI's

I have an enumerated type that is the input/output across several
sub-VIs. Whenever I add an item to the enum in my main VI, do I have to
go and make the same changes to all the other enums in the other VIs?
Is there anyway to avoid this?

-Stephen
0 Kudos
Message 1 of 10
(3,588 Views)
What you want to do is customize your enum as a "typedef". You'll save this as a custom control which you can use in each vi. Changes made to this custom control are reflected in each vi that uses it.

1. Right click on you enum and select Advanced > Customize
2. On the toolbar, change it from Control to Type Def.
3. Add / Delete any items as required.
4. Save this control and close the control editor.
5. Replace the enums in other vi's with this control.

Search the help for type definitions for further help on type def's

Tim
0 Kudos
Message 2 of 10
(3,588 Views)
Thanks for the reply. I'm still having trouble, though. I did as you
suggested below. But whenever I right click on an instance of the
control and select "Open Type Def." and modify the control and save it,
the control instance is not updated with the new values. The "Auto
Update from Type-def" is selected from the right-click menu on the
control instance. How do I get the control instances to update?

I'm using Labview 6.1.

Thanks

Shan wrote:
>
> What you want to do is customize your enum as a "typedef". You'll
> save this as a custom control which you can use in each vi. Changes
> made to this custom control are reflected in each vi that uses it.
>
> 1. Right click on you enum and select Advanced > Customize
> 2. On the toolbar, change it from Control
to Type Def.
> 3. Add / Delete any items as required.
> 4. Save this control and close the control editor.
> 5. Replace the enums in other vi's with this control.
>
> Search the help for type definitions for further help on type def's
>
> Tim
0 Kudos
Message 3 of 10
(3,588 Views)
It should auto-update (as the right-click menu implies). The only thing I can suggest is to make sure the edited control is saved on exiting the control editor. Maybe post the control (.ctl file) and I'll try it out??
Tim
0 Kudos
Message 4 of 10
(3,588 Views)
If you select Strict Type Def instead of Type Def from the drop-down list when editing the control, the auto-update option goes away on the right-click menu and the VI won't even run with a mismatching type-def if it has not been updated... This is what I have used for the application you're talking about. I forget exactly what the differences are between Type Def and Strict Type Def are... since Strict Type Def has always worked that's just what I use now.
0 Kudos
Message 5 of 10
(3,588 Views)
> application you're talking about. I forget exactly what the
> differences are between Type Def and Strict Type Def are... since
> Strict Type Def has always worked that's just what I use now.

Typedefs update when something in the datatype changes. Strict types
update when almost anything about the control changes, color, size, data
type, etc. Typedefs should be acceptable for most uses, and allows for
the instances to look different. Strict typedefs are useful for making
sure that the UI is identical across panels.

Greg McKaskle
0 Kudos
Message 6 of 10
(3,588 Views)
http://home.satx.rr.com/srgray/

On that page is a link to "ResolutionType.ctl". Here's the steps I
take:

1. Open new vi
2. Drop ResolutionType.ctl on the front panel
3. Right click on control, select Open Type Def.
4. Right click on control in control editor.
5. Select Add Item After, etc. and add one item.
6. File->save (in the file menu, Apply Changes is disabled, is that
normal?)
7. Close control editor.
8. Original control is NOT updated.


Thanks for the help,
Stephen

Shan wrote:
>
> It should auto-update (as the right-click menu implies). The only
> thing I can suggest is to make sure the edited control is saved on
> exiting the control editor. Maybe post the control (.ctl file) and
> I'll try it out??
> Tim
0 Kudos
Message 7 of 10
(3,588 Views)
Use 'strict type def'. That worked for me. Just 'type def' did not auto
update. I have always used strict type def in the past.

s wrote:
> http://home.satx.rr.com/srgray/
>
> On that page is a link to "ResolutionType.ctl". Here's the steps I
> take:
>
> 1. Open new vi
> 2. Drop ResolutionType.ctl on the front panel
> 3. Right click on control, select Open Type Def.
> 4. Right click on control in control editor.
> 5. Select Add Item After, etc. and add one item.
> 6. File->save (in the file menu, Apply Changes is disabled, is that
> normal?)
> 7. Close control editor.
> 8. Original control is NOT updated.
>
>
> Thanks for the help,
> Stephen
>
> Shan wrote:
>
>>It should auto-update (as the right-click menu
implies). The only
>>thing I can suggest is to make sure the edited control is saved on
>>exiting the control editor. Maybe post the control (.ctl file) and
>>I'll try it out??
>>Tim
>
0 Kudos
Message 8 of 10
(3,588 Views)
Aha, you're using a Ring Menu (not an enum) - there's a difference, but I'm not sure why. See this for the explanation.

The apparent solution is to (1) make it a strict type def in the control editor or use an enum (which works as I described).

Tim
0 Kudos
Message 9 of 10
(3,588 Views)
Whoops...

thanks all

Shan wrote:
>
> Aha, you're using a Ring Menu (not an enum) - there's a difference,
> but I'm not sure why. See
> href="http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=50650000000800000...

> for the explanation.
>
> The apparent solution is to (1) make it a strict type def in the
> control editor or use an enum (which works as I described).
>
> Tim
0 Kudos
Message 10 of 10
(3,588 Views)