Solved

UNITS

Posted on 2000-03-09
2
170 Views
Last Modified: 2010-04-04
well.....I have a problem..as you know...If we decide tu declare a procedure,, we must declare it in the interface section and in the public section,,,,,,do I have to write something special,?....

I know that the definition of the procedure must be at the implementation section................
but it sent me teh error 108...
can you help me??
0
Comment
Question by:Iamme
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
AttarSoftware earned 25 total points
ID: 2601110
If a procedure is to be part of your form/component, etc then you need to declare it within the class definition.  If it is to be called by other things then it need to be in the public section, if not, the private, eg:

------------------------------

unit Unit1

interface

type
  tForm1 = class( tForm )
    private
      procedure MyFunction( param : longint ) ;
    public
  end ;

implementation

{$R *.RES}

procedure tForm1.MyFunction( param : longint ) ;
begin
  // Code here...
end ;

------------------------------

For a private procedure, and

---------------------------------

unit Unit1

interface

type
  tForm1 = class( tForm )
    private
    public
      procedure MyFunction( param : longint ) ;
  end ;

implementation

{$R *.RES}

procedure tForm1.MyFunction( param : longint ) ;
begin
  // Code here...
end ;

--------------------------------

for a public one...

If the function does not relate to a class, but you still want to call it from outside the current unit, then you do not need to put it into the class definition, but in the interface section instead, eg :

--------------------------------

unit Unit1

interface

type
  tForm1 = class( tForm )
    private
    public
  end ;

  procedure MyFunction( param : longint ) ;

implementation

{$R *.RES}

procedure MyFunction( param : longint ) ;
begin
  // Code here...
end ;

--------------------------

  (note there is no tForm1. infront of the implementation of the procedure)

And if the procedure is not required outside the current unit, then you do not have to declare it in the interface section...

Hope this helps,

Good luck,

Tim.
0
 

Author Comment

by:Iamme
ID: 2601856
ok the information that you sent me explain all about the procedures and qhere to put it ..
can you tell me your e-mail???...because I'm not the best programming and I think I'll have more problems (It's the unique form to learn)....
Thank's..
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month5 days, 5 hours left to enroll

635 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