[Lazarus] Ann: class code creation

Ondrej Pokorny lazarus at kluug.net
Mon Mar 7 21:25:30 CET 2016


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160307/03414838/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: afchjfbi.png
Type: image/png
Size: 2596 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160307/03414838/attachment-0002.png>


More information about the Lazarus mailing list