Solved

How to call an event procedure?

Posted on 1998-08-31
5
148 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run video youtube webbrowse 10 61
Press three keys together and trigger a function 3 55
Performance of SQL statement 37 111
Firemonkey allowing RTL on android 6 29
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

813 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

15 Experts available now in Live!

Get 1:1 Help Now