Defines standard actions to be used in Action Lists in the LCL.

stdactns.pas contains TAction descendents which can be used in TActionList for common actions performed using controls. This file is part of the Lazarus Component Library (LCL).

The following components are registered but not displayed on the Lazarus IDE component palette:

Edit Actions

  • TEditCut
  • TEditCopy
  • TEditPaste
  • TEditSelectAll
  • TEditUndo
  • TEditDelete

Search Actions

  • TSearchFind
  • TSearchReplace
  • TSearchFindFirst
  • TSearchFindNext

Help Actions

  • THelpAction
  • THelpContents
  • THelpTopicSearch
  • THelpOnHelp
  • THelpContextAction

Dialog Actions

  • TFontEdit
  • TColorSelect

File Actions

  • TFileOpen
  • TFileOpenWith
  • TFileSaveAs
  • TFileExit
THintAction - standard action for dealing with requests for a Hint. TCustomHintAction The base class for standard editing actions applied to an edit control.

TEditAction is a TAction descendant which defines the base class for standard editing actions applied to an edit control. It provides a Control property with the TCustomEdit control where the action is applied. It provides an overridden HandlesTarget method to determine if the action can be applied to a specified control.

Do not create instances of TEditAction. Use one of the descendent classes that implement UpdateTarget and ExecuteTarget methods, like:

  • TEditCut
  • TEditCopy
  • TEditPaste
  • TEditUndo
  • TEditSelectAll
  • TEditDelete
TAction TCustomAction TContainedAction TBasicAction
Member with the edit control for the editing action. Sets the value for the Control property. New value for the Control property. Handles the notification performed when a component is added to or removed from the class instance.

Calls the inherited method on entry. Ensures that the value in the Control member is set to Nil when the component is removed from the class instance.

TComponent.Notification
Component for the notification. Operation performed for the component. Destructor for the class instance. TBasicAction.Destroy Indicates if the editing action can be used for the specified target control.

HandlesTarget is a Boolean function which indicates if the editing action can be applied to the object in Target. The return value is True when:

  • Target has been assigned.
  • Control and Target are the same object instance, or...
  • Control is unassigned, and Target is a TCustomEdit descendant.
TBasicAction.HandlesTarget
True when the action can be applied to the target. Object instance with the target control for the action. The edit control associated with this action.

Control is a TCustomEdit property with the control for the standard editing action. Control limits the target for the action to a specific control. Setting a new value for the property causes a free notification to be added or removed as needed for the new property value.

TCustomEdit TComponent.FreeNotification TComponent.RemoveFreeNotification
Editing action used to cut the selected value in a control to the clipboard.

TEditCut is a TEditAction descendant which performs a cut to clipboard editing action for a TCustomEdit control. It re-implements the UpdateTarget and ExecuteTarget methods to use the TCustomEdit type for the affected control.

TCustomEdit
Executes the action for the specified target control.

ExecuteTarget is an overridden method used to execute the editing action for the specified target control. It re-implements the method introduced in the ancestor class.

Target is the object instance where the editing action is applied. It is cast to a TCustomEdit type, and its CutToClipboard method is called to perform the editing action.

TCustomEdit.CutToClipboard TBasicAction.ExecuteTarget
Object where the editing action is applied. Updates the enabled state for the action.

UpdateTarget is an overridden method used to update values in the action based on settings in the specified Target control. UpdateTarget re-implements the method introduced in the ancestor class.

Target is the object instance examined in the method. It is cast to the TCustomEdit type used in the Control property. The Enabled property is set to True when the control in Target has an active text selection (SelLength is not 0).

UpdateTarget is called from the UpdateActions method in TCustomForm when actions and action lists are updated during an application idle state.

TCustomAction.Enabled TBasicAction.UpdateTarget
Object instance with the values examined in the method. Editing action used to copy the selected value in a control to the clipboard.

TEditCopy is a TEditAction descendant which performs a copy to clipboard editing action for the selected value in a TCustomEdit control. It re-implements the UpdateTarget and ExecuteTarget methods to use the TCustomEdit type for the affected control.

TCustomEdit
Executes the action for the specified target control.

ExecuteTarget is an overridden method used to execute the editing action for the specified target control. It re-implements the method introduced in the ancestor class.

Target is the object instance where the editing action is applied. It is cast to a TCustomEdit type, and its CopyToClipboard method is called to perform the editing action.

TCustomEdit.CopyToClipboard TBasicAction.ExecuteTarget
Object where the editing action is applied. Updates the enabled state for the action.

UpdateTarget is an overridden method used to update values in the action based on settings in the specified Target control. UpdateTarget re-implements the method introduced in the ancestor class.

Target is the object instance examined in the method. It is cast to the TCustomEdit type used in the Control property. The Enabled property is set to True when the control in Target has an active text selection (SelLength is not 0).

UpdateTarget is called from the UpdateActions method in TCustomForm when actions and action lists are updated during an application idle state.

TCustomAction.Enabled TBasicAction.UpdateTarget
Object instance with the values examined in the method. Editing action used to paste values from the clipboard into the specified control.

TEditPaste is a TEditAction descendant which copies the contents of the clipboard editing action into the specified TCustomEdit control. It re-implements the UpdateTarget and ExecuteTarget methods to use the TCustomEdit type for the affected control.

TCustomEdit
Updates the enabled state for the action.

UpdateTarget is an overridden method used to update values in the action based on settings in the specified Target control. UpdateTarget re-implements the method introduced in the ancestor class.

UpdateTarget sets the value in Enabled to True when values in the Clipboard includes the CF_TEXT content format.

UpdateTarget is called from the UpdateActions method in TCustomForm when actions and action lists are updated during an application idle state.

TCustomAction.Enabled Clipboard TClipboard.HasFormat TBasicAction.UpdateTarget
Object instance with values examined in the method. Executes the action for the specified target control.

ExecuteTarget is an overridden method used to execute the editing action for the specified target control. It re-implements the method introduced in the ancestor class.

Target is the object instance where the editing action is applied. It is cast to a TCustomEdit type, and its PasteFromClipboard method is called to perform the editing action.

TCustomEdit.PasteFromClipboard TBasicAction.ExecuteTarget
Object instance where the editing action is applied. Editing action used to select all of the content in the value for the specified control.

TEditSelectAll is a TEditAction descendant which selects all of the content in the value for the specified TCustomEdit control. It re-implements the UpdateTarget and ExecuteTarget methods to use the TCustomEdit type for the affected control.

TCustomEdit
Executes the action for the specified target control.

ExecuteTarget is an overridden method used to execute the editing action for the specified target control. It re-implements the method introduced in the ancestor class.

Target is the object instance where the editing action is applied. It is cast to a TCustomEdit type, and its SelectAll method is called to perform the editing action.

TCustomEdit.SelectAll TBasicAction.ExecuteTarget
Object instance where the editing action is applied. Updates the enabled state for the action.

UpdateTarget is an overridden method used to update values in the action based on settings in the specified Target control. UpdateTarget re-implements the method introduced in the ancestor class.

Target is the object instance with values examined in the method. It is cast to the TCustomEdit type used in the Control property, and its Text property is checked for an existing text value. UpdateTarget sets the value in Enabled to True when Text is not an empty string ('').

UpdateTarget is called from the UpdateActions method in TCustomForm when actions and action lists are updated during an application idle state.

TCustomAction.Enabled TCustomEdit.Text TBasicAction.UpdateTarget
Object instance with values examined in the method. Editing action used to Undo the previous change to the value for the specified control.

TEditUndo is a TEditAction descendant which reverses the previous change to the value for the specified TCustomEdit control. It re-implements the UpdateTarget and ExecuteTarget methods to use the TCustomEdit type for the affected control.

TCustomEdit
Executes the action for the specified target control.

ExecuteTarget is an overridden method used to execute the editing action for the specified target control. It re-implements the method introduced in the ancestor class.

Target is the object instance where the editing action is applied. It is cast to a TCustomEdit type, and its Undo method is called to perform the editing action.

TCustomEdit.Undo TBasicAction.ExecuteTarget
Object instance where the editing action is applied. Updates the enabled state for the action.

UpdateTarget is an overridden method used to update values in the action based on settings in the specified Target control. UpdateTarget re-implements the method introduced in the ancestor class.

Target is the object instance with values examined in the method. It is cast to the TCustomEdit type used in the Control property, and its CanUndo method is called to get the value assigned to the Enabled property.

UpdateTarget is called from the UpdateActions method in TCustomForm when actions and action lists are updated during an application idle state.

TCustomAction.Enabled TCustomEdit.CanUndo TBasicAction.UpdateTarget
Object instance with the values examined in the method. Editing action used to remove the current selection in the specified control.

TEditDelete is a TEditAction descendant which removes the current selected text for the specified TCustomEdit control. It re-implements the UpdateTarget and ExecuteTarget methods to use the TCustomEdit type for the affected control.

TCustomEdit
Executes the action for the specified target control.

ExecuteTarget is an overridden method used to execute the editing action for the specified target control. It re-implements the method introduced in the ancestor class.

Target is the object instance where the editing action is applied. It is cast to a TCustomEdit type, and its ClearSelection method is called to perform the editing action.

TCustomEdit.ClearSelection TBasicAction.ExecuteTarget
Object instance where the editing action is applied. Updates the enabled state for the action.

UpdateTarget is an overridden method used to update values in the action based on settings in the specified Target control. UpdateTarget re-implements the method introduced in the ancestor class.

Target is the object instance with values examined in the method. It is cast to the TCustomEdit type used in the Control property, and sets Enabled to True when text is currently selected in the control.

UpdateTarget is called from the UpdateActions method in TCustomForm when actions and action lists are updated during an application idle state.

TCustomAction.Enabled TCustomEdit.SelLength TBasicAction.UpdateTarget
Object instance with values examined in the method. The base class for standard help actions.

THelpAction is a TAction descendant which implements the base class for help actions. It is used as the ancestor for classes including: THelpContents, THelpTopicSearch, THelpOnHelp , and THelpContextAction.

TAction
Constructor for the class instance.

Calls the inherited constructor.

TBasicAction.Create
Owner of the class instance. Determines whether the help action can be applied to the Target control.

Calls the inherited method.

TBasicAction.HandlesTarget
True if the action can be applied to the target control. Object instance with the control examined in the method. Updates the enabled state for the action using values in the target control.

Calls the inherited method.

TBasicAction.UpdateTarget
Object instance with values examined in the method. Help action used to display a Table of Contents for the HelpContext. Executes the help action for the HelpContext.

Calls the inherited method.

TBasicAction.ExecuteTarget
Object instance with the context for the help action. Help action used to search for a help topic. Executes the help action for the help context. Object instance with the help context. Help action used to display the Help on Help topic, or "How to Get Help". Executes the help action. Help action used to get help for a specific help context. Executes the help action. Updates the enabled state for the help action. Class reference for the TCommonDialog type.

Contains the class reference used to create new dialog instances in TCommonDialogAction. TCommonDialogClass is the type returned from the GetDialogClass method in TCommonDialogAction.

Dialog action used to create, configure, and display a dialog. TCustomAction FDialog - local variable holding the Dialog associated with this action. DoAccept - perform the code for the OnAccept event. Performs the BeforeExecute notification when assigned. DoCancel - perform the code for the OnCancel event. GetDialogClass - returns the class type for the dialog associated with this action. Create a new instance of the class type used in the Dialog property.

Calls GetDialogClass to get the class reference used to create the dialog instance. When assigned, it is created and stored in the Dialog property. It Name is set to the ClassName for the class reference, and it is marked as a sub-component for the class instance.

Constructor for the class instance.

Create is the overridden constructor for the class instance, and calls the inherited method on entry. Create calls CreateDialog to create and configure a new instance of the dialog class type used in the implementation. It sets the value in Enabled to True.

TCustomAction.Enabled TBasicAction.Create
Owner of the class instance. ExecuteResult - the result of the execution: True if successful. BeforeExecute - event handler for performance before execution of the action. OnAccept - event handler for a press of the Accept button. OnCancel - event handler for a press of the Cancel button. TFileAction - base class for providing actions associated with various file dialogs and menu options. Gets the value for the FileName property. Value for the property. Sets the value for the FileName property. New value for the property. GetDialog - returns a TOpenDialog for use in this File action. TOpenDialog TOpenDialog instance used in the class. File name returned from the dialog in the action.

FileName is a TFileName property with the file name returned in the Open dialog for the action.

TFileOpen - standard action (including opening a dialog) associated with the File Open menu option. Gets the value for the Dialog property. Value for the property. Gets the class reference used to create the Dialog for the action. TCommonDialogClass reference used to create the Dialog. The Open Dialog to be used with this action.

Dialog is a read-only TOpenDialog property with the dialog used to select a file for the File Open action.

Indicates if the default application should be used to open the file for the action.

UseDefaultApp is a Boolean property which indicates if the default application should be used to open the selected FileName. The default value for the property is False.

UseDefaultApp is not used in the current LCL version.
TFileOpenWith - standard action (including opening a dialog) associated with the File Open With menu option.

TFileOpenWith is a standard action (including opening a dialog) associated with the File Open With menu option. Gives the User an opportunity to choose the application with which to open a file.

File name for the Open With action. FileName is a TFileName property with the file name used in the Open With action. AfterOpen - event handler to be performed after file is opened. TFileSaveAs - standard action (including opening a dialog) associated with the File Save As menu option.

TFileSaveAs is a standard action (including opening a dialog) associated with the File Save As menu option. Gives the user an opportunity to select or enter a name to use for saving the file.

Gets the value for the Dialog property. Value for the Dialog property. The Save Dialog to be used with this action. TFileExit - standard action (closing file and terminating application) associated with the File Exit menu option. TCustomAction TSearchAction - base class for the actions associated with the various Search menu options. FControl - local variable holding the control for use with this action. Creates the class instance used in the Dialog property.

Calls the inherited CreateDialog method, and assigns the Search method as the OnFind event handler in Dialog.

Handles notifications when a control in the class instance is added or removed. TComponent.Notification Component for the notification. Operation for the notification. Updates the internal Control to the value in NewControl. New value for the internal Control. Performs the search action using the Dialog options.

Performs the search action using the options and search criteria set in the Dialog property. Called from the Search method.

True when the search value is found in the text for the internal Control. Displays a dialog with a "Not Found" message. Constructor for the class instance.

Calls the inherited constructor, and sets the value for the internal Control to Nil.

TBasicAction.Create
Owner for the class instance. Destructor for the class instance.

Removes the free notification for the internal Control (when assigned), and calls the inherited destructor.

TBasicAction.Destroy
Performs the Search action. TSearchFind - the action associated with a Search and Find dialog (as opposed to search and replace). Gets the dialog class type.

Returns the TFindDialog class type in TSearchFind.

Returns TFindDialog for the action. The FindDialog to be used with this action. TSearchReplace - action associated with the Search and Replace menu option and dialogs. Replace - the method to perform the Replace action once the specified text has been found. The ReplaceDialog to be used with this action. TSearchFindFirst - Search action to find the first match. TSearchFindNext - search action to find the next match. Constructor for the class instance. Owner of the class instance. Handles notifications when a component used in the class instance is added or removed. TComponent.Notification The SearchFind action to use for searching. TFontEdit - standard action for opening a Font Edit dialog. Gets the value for the Dialog property. Value for the property. The FontDialog to use for this action. TColorSelect - standard action for opening a Color Selection dialog. The ColorDialog to use with this action. Registers component for use in the Lazarus IDE.

The following components are registered but not displayed on the Lazarus IDE component palette:

Edit Actions

  • TEditCut
  • TEditCopy
  • TEditPaste
  • TEditSelectAll
  • TEditUndo
  • TEditDelete

Search Actions

  • TSearchFind
  • TSearchReplace
  • TSearchFindFirst
  • TSearchFindNext

Help Actions

  • THelpAction
  • THelpContents
  • THelpTopicSearch
  • THelpOnHelp
  • THelpContextAction

Dialog Actions

  • TFontEdit
  • TColorSelect

File Actions

  • TFileOpen
  • TFileOpenWith
  • TFileSaveAs
  • TFileExit