How to call an event procedure?

Say I want to a call:

"procedure TfrmMain.tbGoClick(Sender: TObject);"

from another procedure. If I just use tbGoClick; I get the error "Not enough actual params". So I guess I need to put something in place of Sender: TObject. If I use tbGoClick(nil); it works but I'd like to know what is the right way to do this.
LostOneAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
viktornetConnect With a Mentor Commented:
tbGoClick(self);

Regards,
Viktor Ivanov
0
 
viktornetCommented:
Just curious what do you use the Sender for???

Regards,
Viktor Ivanov
0
 
LostOneAuthor Commented:
umm, no clue. That's the procedure that was auto-created for the OnClick event of a toolbar button. Is it not suppose to be there?
0
 
viktornetCommented:
No it's ok. I though you created the procedure for your own use...
If you want to call a button click or what ever procedure is, that uses proc(Sender : TObject);
use the code as I gave you....

Button1Click(self);

This call will implement a click ona abutton without you clicking on it. It's like you clicked...follow this example......

procedure TForm1.Button1Click(Sender : TObject);
begin
  ShowMessage('Cool, huh?');
end;

procedure TForm1.Button2Click(Sender : TObject);
begin
  Button1Click(self);//This will show the message above....
end;

Hope this makes things clearer ;-)

Regards,
Viktor Ivanov
0
 
LostOneAuthor Commented:
ah yes, much clearer =) that's for the quick replies.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.