Recent

Author Topic: Trying to a add a unit to a proyect in Lazarus  (Read 1035 times)

Javier_43

  • New member
  • *
  • Posts: 7
Trying to a add a unit to a proyect in Lazarus
« on: March 21, 2024, 07:08:38 pm »
Hello,
I am a former Delphi user, rather a hobbyist, who a few months ago decided to switch to FP and Lazarus.
I have started a project with a very simple form: a button, a menu with a dialog to search and load a file, a list, a text box...
But I want to add a unit written for Delfhi and that worked in that environment. In Delphi 7 there is/was in the toolbar a button to add a unit, even if it was in another folder, and another button to remove a unit already integrated into the project. I have not been able to find those buttons or commands in the Lazarus IDE.
I've looked on Google and found that, to add a unit, I have to place that unit in the project folder, open it from there with Lazarus, and from the Code Editor add it to the project.
This is so? It seems like a slightly strange and more uncomfortable procedure than Delphi.
So I hope someone can advise me and help a newbie.
Thank you a thousand.

Fibonacci

  • Hero Member
  • *****
  • Posts: 871
  • FPC Unleashed FTW
Re: Trying to a add a unit to a proyect in Lazarus
« Reply #1 on: March 21, 2024, 07:15:15 pm »
Project -> Project Inspector
Drop your files there, or click "Add". To remove right click on the unit and "Remove".
FPC Unleashed - inline vars, tuples, statement expressions, array equality, compound assignments, indexed/lazy labels, no-RTTI & more. ⭐ Star it on GitHub!

mas steindorff

  • Hero Member
  • *****
  • Posts: 571
Re: Trying to a add a unit to a proyect in Lazarus
« Reply #2 on: March 21, 2024, 07:52:44 pm »
even that may not be required. I went a long time without "adding" some of my units to a project because I had already included them with "uses" in the main code.  The complier would see they were needed and would automatic build them.  However it best to Add them the way Fibonacci posted to enable full tool access like search and clean features
windows 10 &11, Ubuntu 21+ IDE 3.4 general releases

 

TinyPortal © 2005-2018