[Lazarus] Component rename in lazarus...

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Feb 14 14:40:17 CET 2011


On Mon, 14 Feb 2011 13:06:50 +0100
Bo Berglund <bo.berglund at gmail.com> wrote:

> By accident I just discovered a feature of Lazarus that I was not
> aware of:
> I had misnamed a component and wanted to correct it, so I gave it a
> new name in the property editor. Then I planned on going over the code
> and change the places where the component was used to the new name.
> 
> But it was already done! Apparently Lazarus keeps tabs on such renames
> and changes the places in the form code where the old name was used to
> the new name! Excellent!! :-)
> This is something I had wanted in Delphi too...

I thought Delphi does that?

 
> Now I am just wondering what other goodies are hidden in Lazarus?
> Pleasant surprieses await, no doubt.
> 
> Question:
> In Delphi I really wanted a feature of the VisualBasic 6 editor but it
> never materialized in Delphi: Case correction.
> 
> This means that if I write a function like this:
> function MyFunc: boolean;
> var
>   MyVar: byte;
>   MyOtherVar: word;
> begin
>   myvar := 23;
>   myothervar := myVar + 56;
> 
> then the editor will immediately correct the case of the variables so
> the code comes out like this:
> 
>   MyVar:= 23;
>   MyOtherVar := MyVar + 56;

Ctrl+Space (identifier completion) copies the case.
Automatic recasing may be unwanted if the declaration has no casing at
all. For example SysUtils is nicer to read than sysutils.

I'm not sure, maybe jcf can fix casing.

 
> And if I later change the declaration to:
>   Myvar: byte;
> 
> then the places it is used will change to the new case style.
> 
> Is there some way one can make this happen in Lazarus?

Shift+Ctrl+E renames variables and references. It does not yet find all
references, but IMO it is already a useful tool.

 
> (I made a quick test but it did not work right off the bat at least)


Mattias




More information about the Lazarus mailing list