Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7869025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:10:59+00:00 2026-06-03T01:10:59+00:00

I am working on a component in Delphi 7 and Delphi 2006 , where

  • 0

I am working on a component in Delphi 7 and Delphi 2006, where I am using a unit which I need to add to the .dpr file of the project on which the component is dropped automatically.
Like the way Eureka Log automatically adds the unit ‘ExceptionLog’ to the project file:

enter image description here

Can anyone tell me how to programmatically add a unit to the project file when I drop my component on any form in the project?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:11:01+00:00Added an answer on June 3, 2026 at 1:11 am

    You most likely have to use the Open Tools API for that.

    Also it might require to write a TSelectionEditor for your component to trigger the adding of the unit (I would try the RequiresUnit method).

    While there is an easy way to just add a unit to the active project (code below) this just works for the active project which might not be the project the form belongs to you are adding the component to. Also it adds the unit at the end of the uses clause.

    uses
      ToolsAPI;
    
    var
      currentProject: IOTAProject;
    begin
      currentProject := GetActiveProject();
      currentProject.AddFile('MyUnit.pas', True);
    

    You can check the GExperts source code because it contains a class (TUsesManager) that can parse units and modify the uses clause.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project using Delphi 7 and Delphi 2006 , i
I'm working on a component installer (only for Delphi XE2) and I would like
I'm working on a Delphi project and I want to add a parser to
I'm working on a project which is composed of several compiled Delphi applications (over
i am working on component for delphi 7 and delphi 2006 , the component
I'm working on a component that is placed on every form of my project.
The project I'm working on uses a 3rd party component called ABCpdf to generate
I'm working on a Delphi project with a MS SQL Server database, I connected
I am working on a Delphi program which will display an icon on the
I am working on one component where I need to scale and rotate image.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.