 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jessica Loriena Guest
|
Posted: Wed Sep 29, 2004 5:25 am Post subject: Using ActionList from another form |
|
|
I would like to set the OnClick event of a component on Form1 to an
ActionClick execute event located on ANOTHER form (Form2), but the
action doesn't appear in the drop-down list in the object inspector.
Form1 has Form2 in uses clause.
How do I do this?
Thanks for your help.
|
|
| Back to top |
|
 |
Don Guest
|
Posted: Wed Oct 13, 2004 5:24 pm Post subject: Re: Using ActionList from another form |
|
|
Hello,
It must be something simple that you're missing (or maybe even a
Delphi restart would do it) .
Here's a sample though (that works fine on my machine) .
unit ufActUsePapa;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, ActnList;
type
TfrmActUsePapa = class(TForm)
ActionListPapa: TActionList;
ActionRoma: TAction;
ActionParis: TAction;
ActionAthena: TAction;
procedure ActionRomaExecute(Sender: TObject);
procedure ActionParisExecute(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmActUsePapa: TfrmActUsePapa;
implementation
{$R *.dfm}
procedure TfrmActUsePapa.ActionRomaExecute(Sender: TObject);
begin
ShowMessage('Roma');
end;
procedure TfrmActUsePapa.ActionParisExecute(Sender: TObject);
begin
ShowMessage('Paris');
end;
end.
----------------------
object frmActUsePapa: TfrmActUsePapa
Left = 643
Top = 246
Width = 284
Height = 268
Caption = 'frmActUsePapa'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object ActionListPapa: TActionList
Left = 24
Top = 22
object ActionRoma: TAction
Caption = 'ActionRoma'
OnExecute = ActionRomaExecute
end
object ActionParis: TAction
Caption = 'ActionParis'
OnExecute = ActionParisExecute
end
object ActionAthena: TAction
Caption = 'ActionAthena'
end
end
end
-----------------------------
unit ufActUseBebe;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, StdCtrls;
type
TfrmActUseBebe = class(TForm)
Button1: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmActUseBebe: TfrmActUseBebe;
implementation
uses ufActUsePapa;
{$R *.dfm}
end.
------------------------
object frmActUseBebe: TfrmActUseBebe
Left = 662
Top = 148
Width = 287
Height = 268
Caption = 'frmActUseBebe'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 22
Top = 28
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
end
end
Best,Don
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|