From RAD Studio API Documentation
Jump to: navigation, search


function CreateAction(AOwner: TComponent; ActionClass: TBasicActionClass; FrameworkType: string = ''): TBasicAction;


extern DELPHI_PACKAGE System::Classes::TBasicAction* __fastcall CreateAction(System::Classes::TComponent* AOwner, System::Classes::TBasicActionClass ActionClass, System::UnicodeString FrameworkType = System::UnicodeString());


Type Visibility Source Unit Parent
function public
System.Actions System.Actions


Creates an action of the specified ActionClass type.

Calling this function does the same thing as calling the constructor of ActionClass. The only difference is that CreateAction uses the Resource parameter of the RegisterActions procedure to initialize the values of the new action object.

To create an action, the CreateAction function calls the procedure stored in the CreateActionProc variable. The IDE should assign the proper procedure to the CreateActionProc variable.

Just before calling the procedure stored in the CreateActionProc variable, CreateAction sets the vDesignAction variable to True. CreateAction restores the initial value of the vDesignAction variable as soon as the execution of the CreateActionProc procedure accomplishes. Therefore, when testing the value of the vDesignAction variable, an action constructor can check whether it is called from the IDE or from a user application.

CreateAction has the following parameters:

  • AOwner is the owner of the action. It is typically the form or data module.
  • ActionClass defines the type of action to create. The type is an action class belonging to the TBasicActionClass type.
  • FrameworkType must specify the GUI application framework where you want to use the action. Its value must be either "VCL" (default) or "FMX" (FireMonkey). You cannot use VCL actions in FireMonkey applications, or vice versa.

See Also