有关自定义Action问题!200(200分)

  • 主题发起人 主题发起人 allenzen
  • 开始时间 开始时间
A

allenzen

Unregistered / Unconfirmed
GUEST, unregistred user!
[:(]
我自定义一个Action:
------------------------------------------------
TData_ApplyUpdate_Action = class(TDataSetAction)
public
procedure ExecuteTarget(Target: TObject); override;
procedure UpdateTarget(Target: TObject); override;
published
property DataSource;
end;
......
...
--------------------------------
但不知道如何加在窗口中,如何直接在窗口里写:
XXX : TData_ApplyUpdate_Action ;
编译说则提示:没有相应的组件,是否去掉!
这个问题该如何解决??
谢谢!
 
你加在TForm的Private里就可以了
 
请问你有没有加在ActionList中?你定义在ActionList中就可在属性栏中选了.
 
写好了当然是第一时间把它注册上去啦!!![:D]
RegisterActions('(None)', [TTData_ApplyUpdate_Action], nil);
放在一个Package中。

procedure RegisterActions(const CategoryName: string;
const AClasses: array of TBasicActionClass; Resource: TComponentClass);
Description
RegisterActions allows a class to appear in the action list editor
or customize dialog as a selection when you choose New Action or
Add Standard Action. The predefined actions that ship with Delphi
are registered automatically. To install your own action classes
so that they can be added to an action list or action manager,
call RegisterActions to register them.
The CategoryName parameter specifies the value of the actions?
Category property.
The AClasses parameter is an array of custom action class names.
The Resource parameter lets you assign default values to the properties
of the actions being registered. Resource is the class of a TDataModule
descendant that contains instances of the action classes listed by AClasses,
where the properties of those instances are set to the default values.
This parameter can be set to nil if there is no need to assign default
values
 
谢谢,已成功加上!
 
后退
顶部