<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/wordpress-mu-1.2.3-2.2.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Deborah Pate</title>
	<link>http://blogs.teamb.com/deborahpate</link>
	<description></description>
	<pubDate>Mon, 05 Dec 2005 12:44:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=wordpress-mu-1.2.3-2.2.1</generator>
	<language>en-GB</language>
			<item>
		<title>Article on code templates</title>
		<link>http://blogs.teamb.com/deborahpate/2005/12/05/22334</link>
		<comments>http://blogs.teamb.com/deborahpate/2005/12/05/22334#comments</comments>
		<pubDate>Mon, 05 Dec 2005 12:44:20 +0000</pubDate>
		<dc:creator>Deborah Pate</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.teamb.com/deborahpate/2005/12/05/22332/</guid>
		<description><![CDATA[Live templates are a nice new feature in BDS 2006, but they are badly documented (as Borland acknowledge). I expect someone will write a blog or a BDN article on the subject soon, but I thought <A href="http://blogs.teamb.com/deborahpate/articles/22331.aspx">a quick guide</A> to creating your own templates might be helpful for now]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written an introduction to writing your own code templates, <A href="http://blogs.teamb.com/deborahpate/articles/22331.aspx">here</A>.&nbsp;</p>
<p class="akst_link"><a href="http://blogs.teamb.com/deborahpate/?p=22334&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_22334" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=Article%20on%20code%20templates&body=Have you seen this? http%3A%2F%2Fblogs.teamb.com%2Fdeborahpate%2F2005%2F12%2F05%2F22334" id="akst_email_22334" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.teamb.com/deborahpate/2005/12/05/22334/feed</wfw:commentRss>
		</item>
		<item>
		<title>Creating live templates in BDS 2006</title>
		<link>http://blogs.teamb.com/deborahpate/2005/12/05/22331</link>
		<comments>http://blogs.teamb.com/deborahpate/2005/12/05/22331#comments</comments>
		<pubDate>Mon, 05 Dec 2005 11:40:18 +0000</pubDate>
		<dc:creator>Deborah Pate</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.teamb.com/deborahpate/2005/12/05/1/</guid>
		<description><![CDATA[Live templates are a nice new feature in BDS 2006, but they are badly documented (as Borland acknowledge). I expect someone will write a blog or a BDN article on the subject soon, but I thought a quick guide to creating your own templates might be helpful for now. &#160; Each template resides in an [...]]]></description>
			<content:encoded><![CDATA[<p><P><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">Live templates are a nice new feature in BDS 2006, but they are badly documented (as Borland acknowledge). I expect someone will write a blog or a BDN article on the subject soon, but I thought a quick guide to creating your own templates might be helpful for now.</SPAN></P> <P><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></P> <P><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">Each template resides in an XML file. You can create the XML file using either <SPAN class="menuitem">File</SPAN>|<SPAN class="menuitem">New</SPAN>|<SPAN class="menuitem">Other Files</SPAN><SPAN class="listpara1"> and then selecting the </SPAN><SPAN class="menuitem">Code Template</SPAN><SPAN class="listpara1"> icon, or View | Templates and then clicking New. Either way, you get an XML file to edit.</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">The first line you need to change is this one:</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"><SPAN style="mso-tab-count: 1"></SPAN><FONT face="Courier New">&lt;template name="" invoke="manual"&gt;</FONT></SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">You need to fill in the template&#8217;s name &#8211; the text that will cause the template to be invoked - </SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">and choose its invocation method. That can be manual, auto, or none: auto invocation means that the template will be invoked if the spacebar is pressed after typing the template&#8217;s name, manual invocation means you can press Tab or Ctrl-J to invoke the template, and none means you need to use Ctrl-J, Ctrl-Space or the Execute button from the Templates pane to invoke it.</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">You can also enter a description of your template, which will appear in the Templates pane, and yourself as author of your new template if you wish. But the other essential part of the XML file is this bit:</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;code language=""&gt;&lt;![CDATA[]]&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">Notice the language tag first. You can specify that your template is for a particular language, including HTML and XML as well as (e.g.) </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">Delphi</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">. Then the Templates pane will show your template when you&#8217;re editing a file of the relevant type. (So if you make a template for </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">Delphi</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">, and you can&#8217;t see it while you&#8217;re editing the template .xml file, now you know why!)</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">On to the </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;![CDATA[]]&gt; </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'">tag. </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">Don&#8217;t believe the helpfile when it tells you to put your template code &#8216;between the </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;![CDATA[]]&gt;</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"> tag and the </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;/code&gt;</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"> tag&#8217; &#8211; that&#8217;s wrong. Your template needs to go between the innermost square brackets of the </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;![CDATA[]]&gt;</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"> tag. For example:</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;!CDATA[OutputDebugString(PChar(&#8221;));]]&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">But just putting text there is rather limited. There are some special values you can use in this tag, but you need to go back to the code tag first and add information about the delimiter you&#8217;ll use to separate them from text. For example:</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;code language="</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">Delphi</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">" delimiter="|"&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">Now we can use &#8216;end&#8217; to tell </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">Delphi</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"> where to put the cursor after the template has been invoked:</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;!CDATA[OutputDebugString(PChar(&#8217;|end|&#8217;));]]&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">You can also use &#8216;*&#8217; to specify indents. Note that white space and carriage returns in the </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;![CDATA[]]&gt; </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'">tag will be observed in your template, though, so if you&#8217;re getting indents you don&#8217;t expect check to see you&#8217;ve removed any spaces.</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"></SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">You can use &#8216;selected&#8217; to include any selected text in your template. So, to place selected text in an </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">{$IFDEF}</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">block:</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;!CDATA[</SPAN></SPAN>{$IFDEF TESTING}</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">|selected|{$ENDIF}</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">|end|]]&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'">When you do something like this, though, you probably also want to set the template to &#8216;surround&#8217;:</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 1"></SPAN></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>&lt;template name="IfTesting" surround="true" invoke="manual"&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'">If you do that, you can invoke your template using the Surround context menu in the code editor. Just select the code you want in the block, right-click, go to Surround and click on your template in the list. Very handy for creating regions!</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'">Last, but not least, we come to &#8216;points&#8217;. Points are the places the cursor will stop in as you Tab through a template, and you can specify default text and hints for them, and even get scripts to run when the user enters and leaves a point. I won&#8217;t deal with the scripts here &#8211; Daniel Wischnewski has already blogged about writing your own script engine: <A href="http://delphi-notes.blogspot.com/2005/12/creating-script-template-engine-for.html"><FONT color="#800080">http://delphi-notes.blogspot.com/2005/12/creating-script-template-engine-for.html</FONT></A> - but I&#8217;ll just show you the basics of creating them.</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;![CDATA[raise |ExceptionClass|.CreateFmt(Format(&#8217;|Message|&#8217;, [|Args|]));</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">|end|]]&gt;</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'"></SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'">Here the points are ExceptionClass, Message, and Args. When you invoke this template you can tab through to each point in turn, accepting the default text, or editing it. For this to work, though, you need to specify some information about each point in the template&#8217;s XML:</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;point name="ExceptionClass"&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>&lt;text&gt;Exception&lt;/text&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>&lt;hint&gt;exception class&lt;/hint&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/point&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;point name="Message"&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>&lt;text&gt;Oops %d&lt;/text&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/point&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;point name="Args"&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>&lt;hint&gt;arguments for Format&lt;/hint&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/point&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: 'Courier New'">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">As you see, you can specify the default text, and the hint that the user will see (if they have hints turned on) &#8211; but you don&#8217;t have to specify either. </SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">You can use one point several times, if you want the text the user writes to be repeated. (Note that only the first instance will be tabbed through.) For example, if you usually call Windows message handlers by the name of the Windows message minus the underscore, you could use a template like this, to save typing the name twice:</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>&lt;point name="MessageID"&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;text&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;/text&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/point&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>&lt;code language="</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">Delphi</SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">" delimiter="|"&gt;&lt;![CDATA[procedure Wm|MessageID|(var Msg: TMessage); message WM_|MessageID|;|end|]]&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">Creating these points in XML seems like a bit of a chore at first. But since you can write templates for XML, you can make it a bit easier with a template for points:</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>&lt;template name="point" invoke="manual"&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;description&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>create a point in code templates</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/description&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;point name="PointName"&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;text&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>PointName</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/text&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/point&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;code language="XML" delimiter="|"&gt;&lt;![CDATA[&lt;point name="PointName"&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">|*|&lt;text&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">|*||*||PointName|</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">|*|&lt;/text&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">|*|&lt;hint&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">|*|&lt;/hint&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;/point&gt;|end|]]&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/code&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/template&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 'Courier New'">&lt;/codetemplate&gt;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">&nbsp;</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">There&#8217;s more to live templates, as you can see from the supplied examples and the codetemplates.xsd file in your {Dephi}ObjReposcode_templates directory, but I hope I&#8217;ve written enough here to get you started.</SPAN></SPAN></P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"></SPAN></SPAN>&nbsp;</P> <P><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">A </SPAN></SPAN><SPAN class="listpara1"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">note on directories: when you go to save your new template, the default directory it will be saved in is </SPAN></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia; mso-bidi-font-family: Sylfaen">{Home}Local SettingsApplication DataBorlandBDS4.0code_templates. But if, like me, you hate stuff being saved to your C drive unnecessarily, don&#8217;t worry: you can save your own templates with the suppled ones in the </SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">{</SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">Delphi</SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">}ObjReposcode_templates directory, and </SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia">Delphi</SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: Georgia"> will see them.</SPAN></P> <P>&nbsp;</P></p>
<p class="akst_link"><a href="http://blogs.teamb.com/deborahpate/?p=22331&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_22331" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=Creating%20live%20templates%20in%20BDS%202006&body=Have you seen this? http%3A%2F%2Fblogs.teamb.com%2Fdeborahpate%2F2005%2F12%2F05%2F22331" id="akst_email_22331" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.teamb.com/deborahpate/2005/12/05/22331/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
