Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to call an event procedure?

Posted on 1998-08-31
5
Medium Priority
?
155 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 200 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

604 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