06-23-2018 01:34 AM
I am unable to place Control.ctt as a control template in Event FGV.vit.
In order to place vi as a template we need to drag .vit file but that does not works for .ctt .
Solved! Go to Solution.
06-23-2018 12:34 PM
A Disclaimer -- I've never worked with Control Templates. However, the concept of a Template inside a Template seems a little weird to me. If your VI is already saved as a Template, so it will "instantiate itself" when used, why do you also need to separately instantiate its front panel control? I'm hoping to learn more about this from other responders ...
Bob Schor
06-24-2018 01:04 AM
You can put .vit template in the LabVIEW\templates\Custom directory and use the template as vi by clicking FILE--> NEW... --->From Template --> Custom and select your template vi for quick use in project, or any place you required.
I always place my Queue Message handler VI and vi template with front panel settings and block diagram using queue handler template for quick start.
I need to put control as template in my template vi so that by creating new vi from template will load new unsaved copy of vi and control, but i am not able to place control; as a Template.
06-24-2018 10:48 AM
I also have several VI Templates that I use when creating a New VI (I use New ... from the File menu, then navigate to the folder where I store my own Custom Templates). Some of them also have Front Panel Controls that automatically instantiate -- indeed, NI's own Templates (I examined Producer/Consumer, Events) just have the Front Panel Controls right on the Template. I could find no discussion of when one should use Control/Indicator Templates, and there don't appear to be any included in LabVIEW 2016 (my "go-to" Version, at the present).
So my assumption that you can build a VI Template with Controls and Indicators and they will be "their own thing" when you open a VI using that Template as a Template. One small confusion with Templates is that they can be used both to create new VIs in Development mode, but can also be called at Run Time to act as "clones" (we used this technique about 8 years ago, but abandoned it quickly in favor of Start Asynchronous Call).
Do Control Templates have a use? The only mention I can find of them in LabVIEW Help and other (quick) searches is how to create them, not how (or why) to use them.
Tapan -- what happens if you create your VI Template with just an "ordinary" Control on the Front Panel? I do understand that if you are making a QMH Template and want a specific Message Type (with, say, an Enum instead of a String), you may need a specific Control for each (different) QMH, and that this (in theory) could be a use for a Control Template.
I did some experimentation, and found a way you might be able to Have Your Cake and Eat It, Too. I created a very tiny VI that included a Message Cluster as a Front Panel item. I created a TypeDef for the Message, saved it, and make sure that the Front Panel referenced it. I then saved this as a VI Template.
When I opened the Template, it referenced the TypeDef that I had created. I could now (when developing my new QMH from this Template) redefine the TypeDef to, say, make the Message an Enum, and it would "stick" with my code. One "gotcha" is where the TypeDef is located -- if it has a "global" location, then other VIs that use this Template will "inherit" the TypeDef unless (as part of setting up the Template) I Disconnect from TypeDef and make a new one saved locally.
Bob Schor
06-24-2018 11:59 PM
Thanks Bob_Schor
I have already created many template for all needs like QMH, Timer and many others,
On master vi when we put subvi as a template by dragging template vi on block diagram the T mark on template subvi appears and creating new vi from master vi, template vi on block diagram is converted to regular unsaved vi.
Likewise i am in need to put custom control as a template on block diagram but this trick does not work for .ctt
06-25-2018 06:35 AM
I got the solution
You need to create .ctt control template as a strict type def or type def instead of control type.
Control type will link control to .ctt
Strict type def and type def will initiate a new control copy.