[Lazarus] Right click, paste as string?

Marcos Douglas md at delfire.net
Sat Apr 21 17:54:26 CEST 2012


On Sat, Apr 21, 2012 at 6:50 AM, Mattias Gaertner
<nc-gaertnma at netcologne.de> wrote:
>
> On Sat, 21 Apr 2012 11:40:28 +0200
> Reinier Olislagers <reinierolislagers at gmail.com> wrote:
>
> > Hi list,
> >
> > When working with e.g. multiline SQL statements, sometimes I want to
> > copy them to a string in Lazarus, e.g from something like:
> > const
> >   SQL =
> > with this on the clipboard:
> > SELECT
> > c.colid as recno,
> > o.name as TableName,
> > c.name as FieldName,
> > c.colorder as FieldPosition,
> > t.name as FieldType,
> > c.scale as FieldScale,
> > c.prec as FieldPrecision,
> > c.isnullable as FieldNull
> > FROM sys.syscolumns c
> > INNER JOIN sys.sysobjects o ON c.id = o.id
> > INNER JOIN sys.systypes t ON c.xtype = t.xtype and c.usertype=t.usertype
> > WHERE (o.type='V' or o.type='U') and o.name='MEDEWERKERS'
> > ORDER BY o.name, c.colorder
> >
> > to something like:
> > Const
> >   SQL =
> >     'SELECT'+
> >     'c.colid as recno,'+
> >     'o.name as TableName,'+
> >     'c.name as FieldName,'+
> >     'c.colorder as FieldPosition,'+
> >     't.name as FieldType,'+
> >     'c.scale as FieldScale,'+
> >     'c.prec as FieldPrecision,'+
> >     'c.isnullable as FieldNull'+
> >     'FROM sys.syscolumns c'+
>
> Maybe line breaks to spaces?
>
>
> >     'INNER JOIN sys.sysobjects o ON c.id = o.id'+
> >     'INNER JOIN sys.systypes t ON c.xtype = t.xtype and
> > c.usertype=t.usertype'+
> >     'WHERE (o.type='V' or o.type='U') and o.name=''MEDEWERKERS'''+
> >     'ORDER BY o.name, c.colorder';
> >
> >
> > I.e. indenting, appending quotes and + sign, and escaping existing
> > quotes. (In this case, it's SQL and having an extra space at the end of
> > the line before the closing quote would be even nicer but that's
> > something of a special case)
> >
> > Is that possible in Lazarus?
>
> No.
> But it is easy to write an IDE plugin that does that.

+1
But I do that using "macro record". First in Delphi but now we have in
Lazarus too (thanks Mattias).

Marcos Douglas




More information about the Lazarus mailing list