I implemented "class code creation" in r51851. I was already tired of creating/copying object variables by hand. The idea is the same as with code creation (ctrl+shift+c), but the variable is created in one of the class section:

unit Unit1;

{$mode objfpc}{$H+}

interface

type
  TClass = class
  private
    procedure Test(y: integer);
  end;

implementation

{ TClass }

procedure TClass.Test(y: integer);
begin
  x| := y;
end;

end.

Hit Ctrl+Shift+X on the undeclared variable x and you get a dialog:



Select the section and voila, x is declared as private variable:

unit Unit1;

{$mode objfpc}{$H+}

interface

type
  TClass = class
  private
    x: Integer;
    procedure Test(y: integer);
  end;

implementation

{ TClass }

procedure TClass.Test(y: integer);
begin
  x := y;
end;

end.

It is the first version, it probably will need some tuning, so please give feedback.

Ondrej
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to