OnClick Procedure

Dave_B_C
Dave_B_C used Ask the Experts™
on
I have a zeroise procedure on an OnClick event. However, I want to perform the same routine from elswhere in the program. When I try to call it I get a compile error saying there are not enough actual parameters...? but there are no parameters? Can I do this...? If so, how..?

Dave
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hi,

Place two buttons on a form and write:

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage('Button1 click');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Button1Click(Sender);
  // or Button1Click(Button1); for example
end;

Regards, Geo
Top Expert 2004

Commented:
? can you show what you do ?

Commented:
Hi Dave,

you can fire the OnClick Event without any Parmeters

procedure TForm1.Button1Click(Sender: TObject);
begin
  showMessage('Hi');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Button1.Click;
end;
 

Good Luck

Cesario

Author

Commented:
Geo, yep that works fine... Thanks

Dave
You are welcome :-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial