procedures calling

How to call procedure (or function) that is placed
(defined) in another Unit?
bor061297Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
erajojConnect With a Mentor Commented:
I suppose you're familiar with the "uses" statement so:

unit main;
   .
uses Unit1...
   .
   .
procedure MyProc(Param: Integer);
begin
   .
   .
end;
   .
   .
..TMainForm.Create...
  Unit1.ExtProc := MyProc; // Copy function pointer
   .
   .
end.  

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

unit Unit1;
   .
   .
var
  ExtProc: procedure (Param: Integer);
   .
   .
  ExtProc(123); // Calls procedure from "Main"
end.  

/// John

0
All Courses

From novice to tech pro — start learning today.