[Lazarus] Code templates syntax

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Jan 10 20:00:57 CET 2012


On Tue, 10 Jan 2012 15:16:24 +0000
Martin <lazarus at mfriebe.de> wrote:

> On 10/01/2012 14:41, Mattias Gaertner wrote:
> >
> >
> > Mattias Gaertner <nc-gaertnma at netcologne.de> hat am 10. Januar 2012 um 
> > 15:33 geschrieben:
> >
> >
> >     Martin <lazarus at mfriebe.de> hat am 10. Januar 2012 um 15:04
> >     geschrieben:
> >
> >     > On 10/01/2012 13:29, Antonio Fortuny wrote:
> >     > > Hi folks.
> >     > >
> >     > > Does anyone know where I can find a syntax description and the
> >     usage
> >     > > rules of all keywords which appear in the source code templates ?
> >     > > And those which do not appear as well ;-)
> >     > > Basically I did find the file
> >     "..\lazarus\ide\lazarus_dci_file.dci"
> >     > > and it already gives some self explanatory rules.
> >     > > My purpose is to enriche as much as possible with code
> >     snippets that I
> >     > > use very often
> >     >
> >     > Have you tried "Insert Macro" In the code-template editor window
> >     > ("Tools" Menu) ?
> >     >
> >     > It lists them all + description
> >
> >     The documentation is here:
> >
> >     http://wiki.lazarus.freepascal.org/IDE_Window:_Code_Templates
> >
> > Martin, can you elaborate how the "param" macro works? The description 
> > is looks a bit confusing:
> >
> > Inserts an editable Cell, with a default value
> > "",Sync=n (,S=n), to Sync with a previous cell (n=1 to highest prev cell
> > "default",Sync, to Sync with a previous cell of equal default
> >
> >
> 
> 
> updated:
> 
>       'Inserts an editable Cell. Cells can be navigated using the tab 
> key.%0:s' +
>       'The "param" macro takes a list of comma separated arguments.%0:s' +
>       'The first argument is the default value.%0:s' +
>       'The 2nd argument (optional) can be used to link the cell to 
> another cell (syncro edit)%0:s' +
>       '%0:s' +
>       '  while param("foo") do param(foo);%0:s' +
>       'Inserts 2 independent cells, both with the default text "foo"%0:s' +
>       'The quotes are optional%0:s' +
>       '%0:s' +
>       '  if param("foo") > 0 and param("foo",sync=1) < 99 then%0:s' +
>       'Inserts 2 linked cells, editing either one, will change the other 
> one too%0:s' +
>       'The value "1" refers to the position of the other "param()", so 
> if there are more params:%0:s' +
>       '  if param("bar") and param(foo) > 0 and param(foo,sync=2) < 99 
> then%0:s' +
>       'The 2nd and third are linked. (the 3rd refers to "2") %0:s' +
>       '%0:s' +
>       '"sync can be shortened to "s":%0:s' +
>       '  if param("foo") > 0 and param("foo",s=1) < 99 then%0:s' +
>       '%0:s' +
>       '  if param("bar") and param("foo") > 0 and param("foo",sync) < 99 
> then%0:s' +
>       'The 2nd and third are linked.%0:s' +
>       'Note: "Sync has no position and no "=", so it syncs to the 
> previous cell with the same default (in this case "foo")' ;

Thanks. Much better.

Mattias




More information about the Lazarus mailing list