[lazarus] Complete Code improved

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Apr 12 08:38:07 EDT 2002


Hi all,

The Complete Code function can now also complete event assignments.

For newbies:
Complete Code can be found under Edit -> Complete Code and its default shortcut is Ctrl+Shift+C.
This function does several things, depending on the cursor position:

1. If the cursor is in a class definition, then Complete Code will complete all properties, add missing property access methods and variables and adds all missing method bodies to the implementation section. This is similar to Delphis Auto Class Completion, but our Complete Code also consider comments and include files.

2. If the cursor is on a function or procedure in the interface section or if the proc has the 'forward' specifier, Complete Code will add a proc body to the code.

3. NEW: if the cursor is behind an event assignment, Complete Code will add a new published method to the class. For example:

    Button1.OnClick:=|

  will be completed to 'Button1.OnClick:=@Button1Click;' and the new method
  'procedure Button1Click(Sender: TObject);' will be added to the class.

Of course this also works for 'with' statements like

  with Button1 do
    Click:=|

or custom event names like

  Button1.OnClick:=@MyButtonClickEvent

or class events like

  constructor TMainForm.Create(TheOwner: TComponent);
  begin
    OnResize:=|
  end;


The exact behaviour can be setup in Environment -> CodeTools Options.


Mattias






More information about the Lazarus mailing list