[Lazarus] Tweaking 'code completion' for event handlers

Graeme Geldenhuys graemeg.lists at gmail.com
Fri May 13 09:48:09 CEST 2011


Hi,

I report a related issue already in the Bug Tracker back in 2009:

   http://bugs.freepascal.org/view.php?id=13994

No solution has been implemented in Lazarus yet. As a work-around, is
there any way to tell Code Completion (Ctrl+Shift+C) for event handlers,
to only generate the code in the interface of the unit, and not the
implementation section?

I like to keep my code implementation in the same order as I have it
defined in the Class definition (as defined in Code Tools settings:
Method Insert Policy = class order). Currently it place the event
handler method always in the undefined published section of my class,
and thus the implementation of that method is in the wrong place too. So
writing the event handler code, then ask Code Completion to implement
the event handler method, I would prefer it (while bug 8135 is not
fixed) if Code Tools could only write the method in the interface
section only. I can then manually move it to the correct location in my
class definition, then do Code Completion again, to implement the
interface section in the correct location.

Is this possible in Lazarus IDE 0.9.30.x? I can't see an obvious option
in Code Tools to adjust this, so I guess the answer is No. I just
thought it worth asking to be sure though.


----8<-------------8<-------------8<-------------8<-------------8<----
  TKeyGenerateForm = class(TfpgForm)
    procedure   meKeyPhraseChanged(Sender: TObject); //<< WRONG LOCATION
  private
    {@VFD_HEAD_BEGIN: KeyGenerateForm}
    Label1: TfpgLabel;
    cbKeyType: TfpgComboBox;
    btnOK: TfpgButton;
    btnCancel: TfpgButton;
    btnGenerateKey: TfpgButton;
    Label2: TfpgLabel;
    memKeyPhrase: TfpgMemo;
    Label3: TfpgLabel;
    edtBlockKey: TfpgEdit;
    edtByteBlockKey: TfpgEdit;
    {@VFD_HEAD_END: KeyGenerateForm}
    FKey: TKey;
    FKeyType: TKeyType;
    procedure   SetKeyType(AValue: TKeyType);
    procedure   FormCreate(Sender: TObject);
    procedure   FormShow(Sender: TObject);
    procedure   cbKeyTypeChanged(Sender: TObject);
  public
    constructor Create(AOwner: TComponent); override;
    procedure   AfterCreate; override;
    procedure   SetKey(AValue: TKey);
    procedure   GetKey(var AValue: TKey);
    property    KeyType: TKeyType read FKeyType write SetKeyType;
  end;

----8<-------------8<-------------8<-------------8<-------------8<----


Regards,
  - Graeme -

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





More information about the Lazarus mailing list