Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to create a TAction and its OnExecute event at runtime Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
24-Aug-03
Category
Others
Language
Delphi 4.x
Views
189
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How to create a TAction and its OnExecute event at runtime 

Answer:

1   { ... }
2   type
3     TForm1 = class(TForm)
4       ActionList1: TActionList;
5       procedure FormCreate(Sender: TObject);
6     private
7       Action1, Action2: TAction;
8       procedure Test(Sender: TObject);
9     end;
10  
11  procedure TForm1.Test(Sender: TObject);
12  begin
13    Caption := IntToStr(Actionlist1.ActionCount);
14  end;
15  
16  procedure TForm1.FormCreate(Sender: TObject);
17  begin
18    Action1 := TAction.Create(Actionlist1);
19    Action1.Actionlist := Actionlist1;
20    Action1.OnExecute := Test;
21    Form1.OnClick := Action1.OnExecute;
22  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC