[Lazarus] Adding unit automatically adds to uses clause

Martin Frb lazarus at mfriebe.de
Sat Mar 26 18:58:01 CET 2022

On 26/03/2022 18:00, Timothy Groves via lazarus wrote:
> Good day.  When I click on "New Pascal Unit" on the toolbar, or select 
> it from the menu, the new unit is automatically added to the uses 
> clause of my main program.  Worse, the new unit is invariably added as 
> "unit1", even after I change the name of the unit.  I cannot seem to 
> find a way to suppress this behaviour. Can anyone tell me how to stop 
> Lazarus from doing this?
I am not aware how to entirely to disable this.

About renaming.
If you do "Save Unit as" and enter a new name, then it should rename the 
unit in other units "uses" clauses.

IMHO, I consider it a bug that it does not update other units, if you 
change the name in source code before you save the unit for the very 
first time.

Obviously, once you saved the unit, you must do "save as" to rename it. 
Otherwise the name in the source, and the filename will not match.

More information about the lazarus mailing list