[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'StdCtrls' (#lcl)

TCustomEdit

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The base class for controls presenting editable text.

Declaration

Source position: stdctrls.pp line 763

type TCustomEdit = class(TWinControl)

protected

  class procedure WSRegisterClass; override;

  

Registers this component class with the current WidgetSet.

  function CanShowEmulatedTextHint; virtual;

  

Indicates if the value in TextHint can be displayed in the edit control.

  procedure CalculatePreferredSize(); override;

  

Gets the preferred size for a new instance of the class.

  procedure CreateParams(); override;

  

Ensures the required creation parameters are set for handle creation.

  procedure InitializeWnd; override;

  

Initializes the window handle for the control.

  procedure TextChanged; override;

  

Applies case conversion (if needed), and updates the editing cursor selection text.

  procedure FontChanged(); override;

  

Handles changes to the font used in the control.

  procedure Change; virtual;

  

Performs actions needed when the text in the control is changed.

  procedure DoEnter; override;

  

Signals the OnEnter event handler, and selects the entire text when AutoSelect is True.

  procedure DoExit; override;

  

Clears the value in AutoSelected when the control loses focus.

  procedure EditingDone; override;

  

Enforces the setting in the ReadOnly property when editing is finished in the control.

  function GetCaretPos; virtual;

  

Gets the value for the CaretPos property.

  function GetNumbersOnly; virtual;

  

Gets the value for the NumbersOnly property.

  function GetReadOnly; virtual;

  

Gets the value for the ReadOnly property.

  function GetSelLength; virtual;

  

Gets the value for the SelLength property.

  function GetSelStart; virtual;

  

Gets the value for the SelStart property.

  function GetSelText; virtual;

  

Gets the value for the SelText property.

  function GetTextHint; virtual;

  

Gets the value for the TextHint property.

  procedure SetCaretPos(); virtual;

  

Sets the value for the CaretPos property.

  procedure SetCharCase(); virtual;

  

Sets the value for the CharCase property.

  procedure SetEchoMode(); virtual;

  

Sets the value for the EchoMode property.

  procedure SetNumbersOnly(); virtual;

  

Sets the value for the NumbersOnly property.

  procedure SetReadOnly(); virtual;

  

Sets the value for the ReadOnly property.

  procedure SetSelLength(); virtual;

  

Sets the value for the SelLength property.

  procedure SetSelStart(); virtual;

  

Sets the value for the SelStart property.

  procedure SetSelText(); virtual;

  

Sets the value for the SelText property.

  procedure SetTextHint(); virtual;

  

Sets the value for the TextHint property.

  function ChildClassAllowed(); override;

  

Indicates whether child controls using the specified class are allowed.

  class function GetControlClassDefaultSize; override;

  

Returns the default dimensions for new instances of the class.

  procedure MouseUp(); override;

  

Handles mouse up events for the control.

  function RealGetText; override;

  

Uses the TextHint display status when getting the value for Text.

  procedure RealSetText(); override;

  

Updates Modified and the TextHint display when storing the new Text value.

  procedure KeyUpAfterInterface(); override;

  

Handles Key Up events forwarded from the LCL interface.

  procedure WMChar(); message;

  

Handles a WM_CHAR window message for the control.

  procedure CMWantSpecialKey(); message;

  

Handles the CM_WANTSPECIALKEY message for the control.

  procedure WndProc(); override;

  

Suppresses the CM_CHANGED control message when an emulated TextHint is visible.

  procedure ShouldAutoAdjust(); override;

  

Determines if the control should auto-adjust its Height and/or Width.

  procedure WMSetFocus(); message;

  

Handles the LM_SETFOCUS message for the control.

  procedure WMKillFocus(); message;

  

Handles the LM_KILLFOCUS message for the control.

  property AutoSelect: Boolean; [rw]

  

Enables auto-selection of text when focused.

  property AutoSelected: Boolean; [rw]

  

Set to True when the text selection was made automatically.

  property ParentColor: Boolean;

  

Uses the Color from the Parent control, when enabled.

public

  constructor Create(); override;

  

Constructor for the class instance.

  destructor Destroy; override;

  

Destructor for the class instance.

  procedure Clear;

  

Deletes all text in the edit box for the control.

  procedure SelectAll; virtual;

  

Selects the entire text in the edit control.

  procedure ClearSelection; virtual;

  

Clears the current text selection in the edit control.

  procedure CopyToClipboard; virtual;

  

Copies the selected text in the control to the clipboard.

  procedure CutToClipboard; virtual;

  

Moves the selected text into the clipboard (removes it from the control).

  procedure PasteFromClipboard; virtual;

  

Inserts text from the clipboard at the current position in the control.

  procedure Undo; virtual;

  

Reverts the last editing action in the control.

  procedure RemoveAllHandlersOfObject(); override;

  

Removes all event handlers assigned for the specified object.

  procedure AddHandlerOnChange();

  

Adds the specified OnChange event handler to the control.

  procedure RemoveHandlerOnChange();

  

Removes the specified OnChange event handler for the list of handlers in the control.

  property Alignment: TAlignment; [rw]

  

The horizontal alignment for the text in the control (left, right, or centered).

  property AutoSize: Boolean;

  

Allows automatic adjustment of the size for the control, according to its content.

  property BorderStyle: TBorderStyle;

  

Indicates the line style drawn as a border around the control.

  property CanUndo: Boolean; [r]

  

Indicates whether the last change can be reverted in the control.

  property CaretPos: TPoint; [rw]

  

The position of the editing cursor in the control.

  property CharCase: TEditCharCase; [rw]

  

Controls the character case applied to values entered in the control.

  property EchoMode: TEchoMode; [rw]

  

Allows to modify the text display, useful for entering passwords.

  property EmulatedTextHintStatus: TEmulatedTextHintStatus; [r]

  

Status for the emulated TextHint in the control.

  property HideSelection: Boolean; [rw]

  

Determines if selected text to be hidden when the control does not have focus.

  property MaxLength: Integer; [rw]

  

The maximum length of the value entered in Text, or 0 (zero) for unlimited length.

  property Modified: Boolean; [rw]

  

True when the value in Text has been changed using the keyboard.

  property NumbersOnly: Boolean; [rw]

  

Indicates if the edit control accepts numeric values only.

  property OnChange: TNotifyEvent; [rw]

  

Event handler signalled when the text for the control is changed.

  property PasswordChar: Char; [rw]

  

Allows obfuscation of the displayed text, showing all characters as PasswordChar.

  property PopupMenu: TPopupMenu;

  

A context-sensitive menu that pops up when the right mouse button is clicked over this control.

  property ReadOnly: Boolean; [rw]

  

Indicates if the user is prevented from changing the value for the Text in the control.

  property SelLength: Integer; [rw]

  

The number of currently selected UTF-8-encoded characters in the control.

  property SelStart: Integer; [rw]

  

The zero-based index for the first UTF-8 character in the current text selection.

  property SelText: string; [rw]

  

The currently selected text in the edit box for the control.

  property TabOrder: TTabOrder;

  

Indicates the navigation order for the control when the user presses the Tab or Shift+Tab key.

  property TabStop: Boolean;

  

Enables keyboard navigation using the Tab or Shift+Tab keys.

  property Text: TCaption;

  

The text displayed and edited for the control.

  property TextHint: TTranslateString; [rw]

  

Default hint text shown when the Text property is empty for the control.

end;

Inheritance

TCustomEdit

  

The base class for controls presenting editable text.

|

TWinControl

  

Implements a windowed control which can contain other child controls.

|

TControl

  

The base class for visible controls.

|

TLCLComponent

  

The base class for LCL components which have an associated widget.

|

TComponent,IUnknown,IInterfaceComponentReference

|

TPersistent,IFPObserved

|

TObject

Description

TCustomEdit is a TWinControl descendant which implements the base class for an edit control presenting a single line of text. TCustomEdit provides properties, methods, and events needed for common editing features in the control, including:

Do not create instances of TCustomEdit in an application; use one of the descendent classes like TEdit, TLabeledEdit, TMaskEdit, or TMemo.

See also

TEdit

  

Implements an edit control with a single line of text.

TMemo

  

Control used to display and edit multi-line text.

TLabeledEdit

  

Implements an edit control with a label bound to the control.

TMaskEdit

  

TMaskEdit is an Edit box with characters masked out to avoid unauthorized reading.

TWinControl

  

Implements a windowed control which can contain other child controls.


Version 3.2 Generated 2024-02-25 Home