[Lazarus] Tweaking 'code completion' for event handlers

Graeme Geldenhuys graemeg.lists at gmail.com
Fri May 13 14:39:45 CEST 2011


On 13/05/2011 14:17, Alexsander Rosa wrote:
> I wish something like this:
> 
> //--- into form's private/public/etc
> a, b, c: TMyClass;
> (some keys are pressed)
> 
> ...FormCreate...
> a := TMyClass.Create;
> b := TMyClass.Create;
> c := TMyClass.Create;
> 
> ...FormDestroy
> a.Free;
> b.Free;
> c.Free;


That would be very specific to LCL TForm descendants only. Not a general
class definition or even forms from other toolkits like fpGUI. Why?
Because only LCL forms have the generic FormCreate() and FormDestry()
methods. And those identifier names are not even a must either, I can
name my LCL.TForm.OnCreate and .OnDestroy event handlers whatever I want.

Maybe you should play with the Code Templates with macros enabled. They
are pretty powerful. I have macros here that create multiple classes and
associated list classes from simply copying a single word into the
clipboard and triggering the macro.

But who knows, maybe the Lazarus Wizards can conjure up something for
you. :)

Regards,
  - Graeme -

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





More information about the Lazarus mailing list