HomeSite Help

VTML Tips and Techniques: Tag Chooser

 

We're moving!

This whole site is being moved to a shiny new server - as are all my sites, in fact. Apologies for the bumpy road ahead, but at the end of that road things will become fast and smooth.

Once the site at the new server is ready, this message will automatically disappear!

Meanwhile, you can see how the move is progressing at the status page.

 
   Home | VTML section | HTML section
On this page:
Editor or inserted tag?
Special tags
Preselecting a tab
Contributions!
 
 

Editor or
inserted tag?

When using the Tag Chooser to insert a tag, it can be hard to remember whether choosing a tag will just insert code into your page or will call up a tag editor dialog. It's happened more than once to me that I clicked a tag name several times thinking I didn't click hard enough, resulting in the tag being inserted more than once into my page, especially when the current cursor position happens to be obscured by the Tag Chooser dialog.

Here's a little trick to make it easier to see the difference:

The CAPTION attribute of the <E> tag in MarkUpTags.vtm contains what is shown in the list box on the right. It doesn't have to be just a tag name, as is the case in the file that comes with HomeSite. You can edit these so that you can see the difference between a tag that is inserted into your document directly and a tag that has a visual editor.

I used the following strategy: tags that are inserted directly are shown as tag with angle brackets (<>), and if an end tag is written, that is shown as well. Tags for which there is a visual editor are still shown only by name. Since the captions in the right-hand list box are sorted alphabetically, the entries for directly inserted code will now be shown together as well, making it even easier to see the difference.

 
  

Here's a small section from the MarkUpTags.vtm file that's included with my VTML Tag Definitions:

<CAT CAPTION="Tag Editor Tags" ICON="Elements">
  <E CAPTION="EDITORLAYOUT"    VALUE='<EDITORLAYOUT'    HELPFILE='Docs/VTMLTags/MKcontrol.html'>
  <E CAPTION="TAGDESCRIPTION"  VALUE='<TAGDESCRIPTION'  HELPFILE='Docs/VTMLTags/TAGDESCRIPTION.htm'>
  <E CAPTION="ATTRIB"          VALUE='<ATTRIB'          HELPFILE='Docs/VTMLTags/MKattributes.html'>
  <E CAPTION="CONTAINER"       VALUE='<CONTAINER'       HELPFILE='Docs/VTMLTags/MKcontrol.html'>
  <E CAPTION="CONTROL"         VALUE='<CONTROL'         HELPFILE='Docs/VTMLTags/MKcontrol.html'>
  <E CAPTION="ITEM"            VALUE='<ITEM'            HELPFILE='Docs/VTMLTags/MKcontrol.html'>
  <E CAPTION="TAG"             VALUE='<TAG'             HELPFILE='Docs/VTMLTags/MKtag.html'>
  <E CAPTION="TAGLAYOUT"       VALUE='<TAGLAYOUT'       HELPFILE='Docs/VTMLTags/MKtaglayout.html'>
  <E CAPTION="<ATTRIBUTES></ATTRIBUTES>"  VALUE='<ATTRIBUTES></ATTRIBUTES>'  HELPFILE='Docs/VTMLTags/MKattributes.html'>
</CAT>
	
  

The result looks as follows:
Tag Chooser list box
 to menu VTML Tips and Techniques


 

Special tags

How do you create an entry for a special tag editor, in other words: a tag editor of which the file name does not correspond to the actual tag name? I'll use my entry for my Mailto: tag editor as an example to illustrate how this is done.

Normally for the Tag Chooser to call a tag editor, the VALUE attribute of the <E> should begin with an open angle bracket followed by the tag name, and without a closing angle bracket. But the tag name after the open angle bracket is not what is written: it's the key to search the Template directory with for a VTM file with the same name.

You can also use the DESC attribute to describe the syntax specific to the special tag. Here's my entry to call a Mailto.vtm tag editor from the Tag Chooser (in reality all on a single line):

<E CAPTION="MAILTO"
   VALUE='<MAILTO'
   DESC='<B>&lt;A</B> <B>HREF</B>="mailto:emailaddress?subject=subject text"
                      <B>ID</B>="id"
                      <B>CLASS</B>="class"
                      <B>STYLE</B>="style"
                      <B>TITLE</B>="title"<B>&gt;&lt;/A&gt;</B>'>
	

To summarize: CAPTION indicates what kind of tag it is in the list box, VALUE tells HomeSite which file to look for, and DESC gives the syntax for (only) a mailto: link, which can be displayed in the local help window of the tag chooser.  to menu VTML Tips and Techniques


 

Preselecting
a tab

Here's one of the type "Wouldn't it be nice if..." where I tried something that seemed a reasonable approach - and... lo and behold it worked!

So: would't it be nice if you could have the Tag Chooser call up a tag editor that contains a TabDialog with a particular tab preselected? Well, if the tab corresponds to an attribute, you can!

Although the focus of this technique is the Tag Chooser (that's where we want something to happen), the example involves not only MarkUpTags.vtm but also the EDITORLAYOUT and ATTRIBUTES section of the tag editor you want to pre-select the tab of; so you'll have to jump to the General section to read all about it.  to menu VTML Tips and Techniques


 

Contributions!

Do you have any VTML Tips or Techniques to share? If it's for the Tag Chooser section, use the following email link, otherwise go to the page corresponding to the section it's about and use the Contributions! mail link from there, so your mail will have the correct subject.

Please explain why it's such a good tip, and illustrate with example code where appropriate. Also let me know whether you want you email address mentioned here, or only your name.

Send your contribution to: mail VTML Tips and Techniques Contributions

The VTML Tips and Techniques sections are:

 to menu VTML Tips and Techniques