LostOne
asked on
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.
"procedure TfrmMain.tbGoClick(Sender:
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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?
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
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
begin
ShowMessage('Cool, huh?');
end;
procedure TForm1.Button2Click(Sender
begin
Button1Click(self);//This will show the message above....
end;
Hope this makes things clearer ;-)
Regards,
Viktor Ivanov
ASKER
ah yes, much clearer =) that's for the quick replies.
Regards,
Viktor Ivanov