Solved

How to call an event procedure?

Posted on 1998-08-31
5
150 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

737 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