?
Solved

Delphi isolate functions and procedures to different file

Posted on 2003-03-26
2
Medium Priority
?
173 Views
Last Modified: 2011-09-20
Hi everyone
               i have written a application on delphi The problem is that the number of lines of my code is more than 5300, so i have desided to isolate the main functions to a different file , i know there is a way to do it by creating files and adding it in the uses claws > can u please tell me how to do this , im just new to delphi
0
Comment
Question by:samuel_chinnu123
2 Comments
 
LVL 7

Expert Comment

by:Motaz
ID: 8215507
in File Menu, Click Add, and Select unit: then you will get an empty unit template:

unit Unit2;

interface

implementation

end.

- Save this unit
- in implementation write all procedures and functions you need
- in Interface section, write all procedure/function headers that you want other units to access it:

unit Test

interface

function Sum(a, b: Integer): Integer;

implementation

function Sum(a, b: Integer): Integer;
begin
  Result:= A + B;
end;

end.

- Alos you can put all global variables and types you want others to see it in Interface section:

interface
type
  TRec = record
    name: string;
    DOB: TDateTime;
   end;
var
  state: Integer;


   
to call that function from other units, go to File/Add Unit and select that unit name

then you can call any procedure and function on that unit the same you do to local function/procedure

Motaz
0
 

Accepted Solution

by:
sammy_chinnu earned 240 total points
ID: 8222317
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question