【发布时间】:2008-10-29 18:02:56
【问题描述】:
我正在将我的应用程序迁移到 delphi 2009。我的应用程序必须仍然使用大量 AnsiString。在迁移期间,我发现自己总是在转换:
abc := def;
进入:
abc := string(def);
或
abc := TDeviceAnsiString(def);
我知道我应该能够使用模板来做到这一点,但我发现模板——尽管功能强大——并不容易上手。这是我一直在尝试的:
<?xml version="1.0" encoding="utf-8" ?>
<codetemplate xmlns="http://schemas.borland.com/Delphi/2005/codetemplates"
version="1.0.0">
<template name="das" invoke="auto">
<point name="expr">
<script language="Delphi">
InvokeCodeCompletion;
</script>
<hint>
MP: TDeviceAnsiString
</hint>
<text>
True
</text>
</point>
<description>
MP: TDeviceAnsiString
</description>
<author>
Mike
</author>
<code language="Delphi" context="any" delimiter="|"><![CDATA[TDeviceAnsiString(|selected|)|end|]]>
</code>
</template>
</codetemplate>
它不会出现在环绕声菜单中,也不会在我想要的时候激活。我希望能够
abc := **das***[tab]*def;
或者选择“def”并使用“surround”得到:
abc := TDeviceAnsiString(def);
感谢您的帮助!
【问题讨论】:
标签: delphi delphi-2009 live-templates