Topic: Calling an existing procedure

Is it possible to call an already existing procedure from a procedure?

Re: Calling an existing procedure

Yes, sure.

Dmitry.

Re: Calling an existing procedure

Ok, and what is the syntax as I am not yet familiar with Delphi / Pascal?

Re: Calling an existing procedure

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
    procedure1;
end;

procedure procedure1;
begin
  procedure2;
end;

procedure procedure2;
begin
  ShowMessage('Hello from proc 2');
end;
Dmitry.

Re: Calling an existing procedure

Ah ok, I thought it would be possible to call procedure Form1_Button1_OnClick from another procedure...

Re: Calling an existing procedure

Why not, you can.


procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
    ShowMessage('call from proc 1');
end;

procedure procedure1;
begin
  Form1_Button1_OnClick('', False);
end;
Dmitry.

Re: Calling an existing procedure

Ok, I will have to work on that, thank you Dmitry. I need some exercices to get it right smile