Solved

How to call an event procedure?

Posted on 1998-08-31
5
145 Views
Last Modified: 2010-04-04
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.
0
Comment
Question by:LostOne
  • 3
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
ID: 1338297
tbGoClick(self);

Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1338298
Just curious what do you use the Sender for???

Regards,
Viktor Ivanov
0
 

Author Comment

by:LostOne
ID: 1338299
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
 
LVL 10

Expert Comment

by:viktornet
ID: 1338300
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
 

Author Comment

by:LostOne
ID: 1338301
ah yes, much clearer =) that's for the quick replies.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now