Jump to content

Control Templates


Recommended Posts

I have a supid question.

I have created some control templates of my common control clusters I use as type defs. This is really cool! This should save me time and I am a happy labview programmer. However how do I load these now? When I go to File\New all my vi templates are there, but not my control templates.

How do I load in my custom control templates? Is saving them in the template directory a good idea?

What am I to do?

Thanks

Dan

Link to comment

QUOTE(ASTDan @ Aug 1 2007, 01:43 PM)

I have a supid question.

I have created some control templates of my common control clusters I use as type defs. This is really cool! This should save me time and I am a happy labview programmer. However how do I load these now? When I go to File\New all my vi templates are there, but not my control templates.

How do I load in my custom control templates? Is saving them in the template directory a good idea?

What am I to do?

Thanks

Dan

In your dialog, is ".ctt" one of the options?

Ben

Link to comment

QUOTE(ASTDan @ Aug 1 2007, 12:38 PM)

Doing some experimenting, there is only one way I can get a control to show up in the File|New templates...

It seems that the filtering that is being done by the File|New browser is not anchored to the end of the file name, so you can get anything to show up in the File|New templates directory by naming it with a ".vit" or ".vi" anywhere in the file name.

For example, if you create a directory in the "<LabVIEW>\templates" directory and place in it a control like this:

http://forums.lavag.org/index.php?act=attach&type=post&id=6515''>http://forums.lavag.org/index.php?act=attach&type=post&id=6515'>http://forums.lavag.org/index.php?act=attach&type=post&id=6515

...you'll find it listed in the list of templates in the File|New browser. Make sure to give the control template a decent description in it's properties or else you may see some oddness in the description window (I saw a description of the "Generate, Analyze and Display" tutorial in my control's description until I gave it a real description which was very odd). Also, note that if you want it to not be listed as "My_Control.vit.ctt" in the File|New browser you should rename the Window Title in the .ctt "Window Appearance" control properties.

However... with this workaround, there are some caveats.

If you're familiar with how the templates directory works, you'll know that you can normally take a file like "sample.vit" and place it into a directory with a .txt file and two .png files with the format of "sample.txt", "sampled.png" and "samplep.png" (one .png for the block (d)iagram and the other for the front (p)anel ). The text file has one line in it that replaces what you see on the templates browser (ie: putting "Yo ho, Sailor!" into the text file will make it appear as such in the browser instead of just "sample.vit"). You can also use the Window Title instead of the .txt file if you'd prefer, but the .txt file over-rides the Window Title if it is present. The .png files are the pretty screenshots you see when you select the template from the list.

Unfortunately, with the above control template workaround, you must match the whole file name with the .txt and .png files in order to get it to work. This has some really ugly side effects.

For example, a control template named "sample.ctt" would be saved in the template directory as "sample.vit.ctt" to get it to show up in the browser. That works great, and you can even get it to show up cleanly by renaming the Window Title of the control to "sample". But if you decide to use the .txt file or .png files, they would have to be named "sample.vit.ctt.txt", "sample.vit.cttd.png" and "sample.vit.cttp.png". (yes, you have to have the full file name *with* extension in this case in order for it to work). This creates a nice description and pictures that display when the user clicks on the template from the File|New browser. HOWEVER, since the filtering is not so smart (which is why this works in the first place) the three support files are *also* listed in the browser because they *all* include ".vit" in their file name! Ick!

I'm not sure why NI decided to not include .ctt files in the template browser filtering in the first place, or if this was just an oversight that will be corrected in future releases. At least there is a workaround (without the .txt and .png support) which I've tested successfully in LV7.1.1, LV8.0.1, and LV8.2.1.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.