Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi DeclareVariable bei Live-Templates (https://www.delphipraxis.net/103877-declarevariable-bei-live-templates.html)

Alex_ITA01 23. Nov 2007 11:24


DeclareVariable bei Live-Templates
 
Hallo zusammen,
ich habe schon herausgefunden, wie man in einem Live-Template eine Variable deklariert aber wie kann ich den Datentyp festlegen, wie ich sie deklarieren möchte?

Delphi-Quellcode:
 <script language="Delphi" onenter="false" onleave="true">DeclareVariable(|index|);</script>
Ich möchte die Variable "index" vom Typ Integer deklarieren.
Geht das und wenn ja, wie?

Danke und viele Grüße,
Alex

Chemiker 23. Nov 2007 20:17

Re: DeclareVariable bei Live-Templates
 
Hallo Alex_ITA01,

vielleicht hilft Dir das weiter:

Delphi-Quellcode:
<?xml version="1.0" encoding="utf-8" ?>
<codetemplate   xmlns="http://schemas.borland.com/Delphi/2005/codetemplates"
            version="1.0.0">
   <template name="index1:" invoke="auto">
      <description>
         index: integer
      </description>
      <author>
         Chemiker
      </author>
      <point name="integer" editable="false">
         <text>index</text>
      </point>
      <point name="typ" editable="false">
         <text>Integer</text>
      </point>
      <script language="Delphi" onenter="false" onleave="true">
         DeclareVariable(|integer|, |typ|);
         RemoveTemplate;
      </script>
      <code language="Delphi" context="methodbody" delimiter="|">
      <![CDATA[|integer||typ|]]>
      </code>
   </template>
</codetemplate>
Habe das VAR – Template von Delphi dafür etwas umgebaut.

Der Name vom Template ist in meinem Beispiel „index1:“

Bis bald Chemiker


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:11 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz