Solved

UNITS

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 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