Solved

UNITS

Posted on 2000-03-09
2
166 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML text in the body of an email (delphi code) 12 96
Create a path if not exists 7 69
FMX and jaudiotracker playing memory stream 29 66
DBGrid or StringGrid ? 6 71
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now