[Lazarus] Syncro-Edit with Code Templates?

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Oct 21 08:47:02 CEST 2011


Hi,

I've setup a Code Templates 'lsi' (Logging with SendInteger(...)). When
I press Ctrl+J I would like the following to appear with the cursor
inside the first parameter of the SendInteger() call. Now the tricky
part. I would ideally also like to have something like Syncro-Edit
automatically enabled for the inserted code, so that when I change the
first parameter, the second parameter is changed too.

eg of initial result after Ctrl+J:

  SendInteger('data', data);


eg of end result:

  SendInteger('Form1.Name', Form1.Name);


Is something like this possible with Lazarus 0.9.30.x and Code Templates
and maybe some of the Code Template Macros?

I looked at the $Param() and $PrevWord() code template macros, but can't
figure out how to use them, so I don't know if they might be a solution.


The end result is that SendInteger() will then log the following to the
debug server:
   Form1.Name = 'MyFirstForm'

... but I didn't have to type 'Form1.Name' twice in my code.

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/





More information about the Lazarus mailing list