LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reuse code with llb?

A quick question for those that know!

 

I have written a small queue manager VI for using with QSMs. The Q manager has a type defined enum for STATES and a type defined 'state cluster' which is just a cluster of the state enum and variant data for passing between states.

 

Currently when I use this Q manager in a new state machine (Say.. AppCtrl) I save a copy of it and the type defs with a new name eg. QMGR_AppCtrl, State_AppCtrl and StateClstr_AppCtrl.

 

It seems there must be a better way than this? Are libraries the way to go? Could I somehow create a template I can put on the pallete such that when I drag a Q manager onto a VI it automatically adds a new type defd state enum and cluster to the project?

 

Many Thanks,

Steve.

0 Kudos
Message 1 of 3
(2,443 Views)
how about saving the type def from ".ctl" to ".ctt" (control template)
Regards
Guru (CLA)
0 Kudos
Message 2 of 3
(2,410 Views)

You already mentioned the keyword 'template'. Those have the file extensions *.vit and *.ctt. You can create a template from the New.. dialog and select VI Template or Control Template.

If you place the vit inside your template folder, you can access it via the same New.. dialog (but this is not working with controls). But you can have the ctt's (and other vit's)placed inside your vit (you need to try around how to place it as templates, those are shown with a big blue T on the diagram)

You can also place it on your palette to drop it on the BD of your project.

 

My knownledge is limited to LV 7.1, where this wasn't smooth and it was improved in later versions. I found out most by trial-and-error, as the behaviour is a bit different if you browse for the ctt/vit from the palette browse option, drop it from a user palette or drag-and-drop it from the explorer (Win). Furthermore, the behaviour also seems to be dependent wether you edit a vi or vi-template. Also there are some options available if you edit the palette (right click on the vi/vit).

 

Felix 

0 Kudos
Message 3 of 3
(2,403 Views)