Monday, December 05, 2005

More on creating Live-Coding Templates

This time I will not show you a fancy Live-Coding Template, but want to let you in on what types you can use for them and how to do that.

Actually, it is rather simple to create new templates. In the View menu of Borland Delphi 2006, chose the Template entry. Right click in that window and select New from the context menu. Now note that you got a new XML file, itself controlled by a Live-Coding Template. Nice touch ;-)

First you need to enter a name for the template, which needs to be unique within the language you want that template working for. Using [tab] you come to the description node, the author node, and the language attribute. For a list of all languages supported, see below. You should add an attribute "delimiter" and set its value to "|", or any delimiter you want to use.

In the CDATA node, you add the code, which you want to be inserted when invoking this template. All synchronization points should be surrounded using that6 defined delimiter. For each synchronization point (note: you can use the same multiple times in the code, thus synchronizing them automatically as the user types) you must add a node which should contain a node with the default value and a node with a hint shown to the user.

A sample for CSS nodes can be downloaded from here, helping you to automatically insert the CSS attributes for scrollbar-manipulation in IE-based browsers. Save that into your local application folder of your profile -> Borland\BDS\4.0\code_templates. (Just a simple sample, but you can come up with much better ones for yourself, I am sure.)

The list of Live-Coding Templates supported can be found in the CodeTemplateAPI.pas file of your Borland Developer Studio 2006 installation.
  • CSharp
  • VB
  • Jsharp
  • HTML
  • XML
  • Delphi
  • C
  • IDE
  • SQL
  • IDL
  • JavaScript
  • CSS
  • INI
  • PHP


Have fun and put your Live-Coding Templates online at Borlands CodeCentral for everyone.

2 Comments:

Anonymous Anonymous said...

> A sample for CSS nodes can be
> downloaded from here, helping you to
> automatically insert the CSS attributes
> for scrollbar-manipulation in IE-based browsers.

hmm... Doesn't D'06 provide intellisense for XML files according to a given schema?

6:27 PM  
Blogger Daniel "sakura" Wischnewski said...

Yes, but you have to select each entry seperately from the list of options. This Template will include them all at once after typing "scrollbars[tab]".

As I've said, it's certainly not the most exciting sample, but it shows the idea pretty well ;-)

6:36 PM  

Post a Comment

<< Home

Google
Search WWW Search delphi-notes.blogspot.com