CustomEdit#

Qualified name: delphivcl.CustomEdit

class CustomEdit#

Bases: WinControl

TCustomEdit is the base class from which all edit-box and memo controls are derived. TCustomEdit encapsulates the behavior common to all components for editing text by introducing methods and properties that provide: Basic text editing functions such as selecting text, modifying selected text, and case conversions. Ability to respond to changes in the contents of the text. Access control of the text for making it read-only or introducing a password character to hide the actual value. Do not create instances of TCustomEdit. Use TCustomEdit as a base class when declaring control objects that permit the user to enter or modify text. Properties and methods of TCustomEdit provide basic behavior that descendant classes inherit as well as behavior that components can override to customize their behavior.

Methods

CanFocus

Indicates whether a control can receive focus.

Clear

Deletes all text from the edit control.

ClearSelection

Removes the selected text from the edit control.

ClearUndo

Clears the undo buffer so that no changes to the text can be backed out.

CopyToClipboard

Copies the selected text in the edit control to the Clipboard in CF_TEXT format.

Create

Creates an instance of TCustomEdit.

CutToClipboard

Copies the selected text to the Clipboard in CF_TEXT format and then deletes the selection.

DefaultHandler

Provides message handling for all messages that the control does not fully process itself.

GetControlsAlignment

Indicates how text is aligned within the control.

GetSelTextBuf

Copies the selected text into a buffer and returns the number of characters copied.

PasteFromClipboard

Pastes the contents of the Clipboard into edit control, replacing the current selection.

SelectAll

Selects all text in the edit control.

SetFocus

Gives the input focus to the control.

SetSelText

Sets the SelText property.

SetSelTextBuf

Replaces the selected text with a null-terminated string.

Undo

Backs out all changes in the undo buffer.

Attributes

Action

Specifies the action associated with the control.

Align

Determines how the control aligns within its container (parent control).

AlignDisabled

Indicates child control realignment disabled.

AlignWithMargins

Specifies whether a control should be constrained by margins.

Alignment

Determines how the text is aligned within the text edit control.

Anchors

Specifies how the control is anchored to its parent.

BiDiMode

Specifies the bidirectional mode for the control.

BoundsRect

Specifies the bounding rectangle of the control, expressed in the coordinate system of the parent control.

Brush

Determines the color and pattern used for painting the background of the control.

CanUndo

Indicates whether the edit control contains changes that can be backed out.

CanUndoSelText

When set to True, it allows you to call or invoke an Undo operation in order to undo a change previously made by using SetSelText or SetSelTextBuf.

ClassName

Returns the TObject.ClassName

ClientHeight

Specifies the height of the control's client area in pixels.

ClientOrigin

Specifies the screen coordinates (in pixels) of the upper-left corner of a control's client area.

ClientRect

Specifies the size of a control's client area in pixels.

ClientWidth

Specifies the horizontal size of the control's client area in pixels.

ComObject

Specifies the interface reference implemented by the component.

ComponentCount

Indicates the number of components owned by the component.

ComponentIndex

Indicates the position of the component in its owner's Components property array.

ComponentState

Describes the current state of the component, indicating when a component needs to avoid certain actions.

ComponentStyle

Governs the behavior of the component.

Components

<Delphi indexed property Components of type TComponent at 21141642500>

Constraints

Specifies the size constraints for the control.

ControlCount

Returns the count of contained controls

ControlState

Specifies the current state of a control at run time.

ControlStyle

Determines style characteristics of the control.

Controls

Returns an iterator over contained controls

CurrentPPI

Embarcadero Technologies does not currently have any additional information.

Cursor

Specifies the image used to represent the mouse pointer when it passes into the region covered by the control.

CustomHint

CustomHint is a custom hint for the control.

DesignInfo

Contains information used by the Form designer.

DockClientCount

Specifies the number of controls that are docked on the windowed control.

DockClients

<Delphi indexed property DockClients of type TWinControl at 211416EE520>

DockManager

Specifies the control's docking manager interface.

DockOrientation

DockOrientation specifies how the control is docked relative to other controls docked in the same parent.

DockSite

Specifies whether the control can be the target of drag-and-dock operations.

DoubleBuffered

Determines whether the control's image is rendered directly to the window or painted to an in-memory bitmap first.

Enabled

Controls whether the control responds to mouse, keyboard, and timer events.

ExplicitHeight

Specifies the explicit vertical size of the control in pixels.

ExplicitLeft

Specifies the explicit horizontal pixel coordinate of the left edge of a component relative to its parent.

ExplicitTop

Specifies the explicit vertical pixel coordinate of the top edge of a component relative to its parent.

ExplicitWidth

Specifies the explicit horizontal size of the control in pixels.

Floating

Specifies whether the control is floating.

FloatingDockSiteClass

Specifies the class of the temporary control that hosts the control when it is floating.

Focused

Determines whether the control has input focus.

Handle

Provides access to the underlying Windows screen object for the control.

HandleAllocated

Reports whether a screen object handle exists for the control.

Height

Specifies the vertical size of the control in pixels.

HelpContext

The HelpContext property contains the numeric context ID that identifies the Help topic for the control.

HelpKeyword

The HelpKeyword property contains the keyword string that identifies the Help topic for the control.

HelpType

Specifies whether the control's context-sensitive Help topic is identified by a context ID or by keyword.

Hint

Hint contains the text string that appears when the user moves the mouse over the control.

HostDockSite

Specifies the control in which the control is docked.

IsDrawingLocked

IsDrawingLocked property returns True when redrawing for this control is locked.

LRDockWidth

Specifies the width of the control when it is docked horizontally.

Left

Specifies the horizontal coordinate of the left edge of a component relative to its parent.

Margins

Specifies the margins of the control.

Modified

Indicates whether the user edited the text of the edit control.

MouseInClient

Indicates whether the mouse pointer is currently in the client area of the control.

Name

Specifies the name of the component as referenced in code.

Observers

Indicates the TObservers object added to the TComponent.

OnGesture

<Delphi property OnGesture of type TControl at 211418EC500>

Owner

Indicates the component that is responsible for streaming and freeing this component.

Padding

Specifies the padding of a control.

Parent

Specifies the parent of the control.

ParentCustomHint

Specifies where a control looks for its custom hint.

ParentDoubleBuffered

ParentDoubleBuffered defers the DoubleBuffered property of this component to the value of the parent's DoubleBuffered property.

ParentWindow

Reference to parent's underlying control.

PixelsPerInch

Embarcadero Technologies does not currently have any additional information.

ReadOnly

Determines whether the user can change the text of the edit control.

RedrawDisabled

RedrawDisabled property returns True when redrawing for this control is locked.

ScaleFactor

Embarcadero Technologies does not currently have any additional information.

SelLength

Specifies the number of characters (bytes) that are selected.

SelStart

Specifies the position of the first selected character in the text.

SelText

Specifies the selected portion of the edit control's text.

ShowHint

ShowHint specifies whether to show the Help Hint when the mouse pointer moves over the control.

Showing

Indicates whether the control is showing on the screen.

StyleElements

Specifies the style elements that are used by the control.

StyleName

Embarcadero Technologies does not currently have any additional information.

TBDockHeight

Specifies the height of the control when it is docked vertically.

TabOrder

Indicates the position of the control in its parent's tab order.

TabStop

Determines whether the user can tab to a control.

Tag

Stores a NativeInt integral value as a part of a component.

Text

Contains a text string associated with the control.

TextHint

A hint or message to be displayed when the Text property is empty.

Top

Specifies the Y coordinate of the upper-left corner of a control, relative to its parent or containing control in pixels.

Touch

Specifies the touch manager component associated with the control.

UndockHeight

Specifies the height of the control when it is floating.

UndockWidth

Specifies the width of the control when it is floating.

UseDockManager

Specifies whether the docking manager is used in drag-and-dock operations.

VCLComObject

Represents information used internally by components that support COM.

Visible

Specifies whether the component appears onscreen.

VisibleDockClientCount

Specifies the number of visible controls that are docked on the windowed control.

Width

Specifies the horizontal size of the control or form in pixels.

WindowProc

<Delphi property WindowProc of type TControl at 211418EC1C0>

Alignment#

Determines how the text is aligned within the text edit control. Use Alignment to change the way the text is formatted in the text edit control. Alignment can take one of the following values:

Value

Meaning

taLeftJustify

Align text to the left side of the control

taCenter

Center text horizontally in the control.

taRightJustify

Align text to the right side of the control.

CanFocus()#

Indicates whether a control can receive focus.

CanUndo#

Indicates whether the edit control contains changes that can be backed out. Read CanUndo to determine whether the user has made any changes to the text that can be undone by calling the Undo method. This is useful when enabling or disabling menu items that correspond to these commands.

CanUndoSelText#

When set to True, it allows you to call or invoke an Undo operation in order to undo a change previously made by using SetSelText or SetSelTextBuf. By default it is set to false.

Clear()#

Deletes all text from the edit control. Use Clear to replace the Text property with an empty string. Clear removes all text, not just the selected text. To remove just the selected text, use ClearSelection.

ClearSelection()#

Removes the selected text from the edit control. Use ClearSelection to delete the selected text from the edit control. If no text is selected, ClearSelection does nothing. If all of the text is selected, ClearSelection clears all text, like the Clear method.

Note: Calling ClearSelection does the same thing as sending the edit control a WM_CLEAR message.

ClearUndo()#

Clears the undo buffer so that no changes to the text can be backed out. Use ClearUndo to commit changes to the Text property. After calling ClearUndo, the CanUndo property is false and the Undo method does nothing.

ControlCount#

Returns the count of contained controls

Controls#

Returns an iterator over contained controls

CopyToClipboard()#

Copies the selected text in the edit control to the Clipboard in CF_TEXT format. Use CopyToClipboard to replace the contents of the Clipboard with the selected text. CopyToClipboard does not clear the Clipboard if no text is selected. If no text is selected, CopyToClipboard does nothing.

Note: Calling CopyToClipboard does the same thing as sending the edit control a WM_COPY message.

Create(AOwner: Component)#

Creates an instance of TCustomEdit. Call Create to create and initialize an instance of TCustomEdit. AOwner is another component, typically the form, that is responsible for freeing the edit control. It becomes the value of the Owner property. Derived objects that override the Create method should call the inherited Create before performing any additional initialization.

CutToClipboard()#

Copies the selected text to the Clipboard in CF_TEXT format and then deletes the selection. Use CutToClipboard to replace the contents of the Clipboard with the selected text while clearing the selected text. If no text is selected, CutToClipboard does nothing.

Note: Calling CopyToClipboard does the same thing as sending the edit control a WM_CUT message.

DefaultHandler(Message)#

Provides message handling for all messages that the control does not fully process itself. Override DefaultHandler to change the default message handling for the edit control. The Message parameter can be cast to a TMessage type to obtain the WParam, LParam, and Result of the message. If the Result of the message is non-zero, the message has already been handled. Set the Result field to a non-zero value to prevent further processing of the message by the inherited method.

Note: In Delphi, calling inherited in a message-handling method results in a call to the ancestor’s DefaultHandler method if that ancestor does not specify a handler for the message being handled.

Focused#

Determines whether the control has input focus.

GetControlsAlignment()#

Indicates how text is aligned within the control. Vcl.StdCtrls.TCustomEdit.GetControlsAlignment inherits from Vcl.Controls.TControl.GetControlsAlignment. All content below this line refers to Vcl.Controls.TControl.GetControlsAlignment. Indicates how text is aligned within the control. Use GetControlsAlignment to determine the alignment of the control. For controls that do not have an Alignment property, GetControlsAlignment returns taLeftJustify.

Note: GetControlsAlignment returns the alignment of text before it is altered by the BiDiMode property. To check whether the alignment should be reversed to reflect the BiDiMode property, call UseRightToLeftAlignment.

GetSelTextBuf(Buffer: PWideChar, BufSize: Integer) Integer#

Copies the selected text into a buffer and returns the number of characters copied. Use GetSelTextBuf to copy the selected text into a character buffer. If there is no selection, the buffer receives an empty string. If the selection contains more than (BufSize - 1) characters, only the first (BufSize - 1) characters are copied. GetSelTextBuf returns the number of characters that were actually copied into the buffer.

Handle#

Provides access to the underlying Windows screen object for the control.

HandleAllocated#

Reports whether a screen object handle exists for the control.

Modified#

Indicates whether the user edited the text of the edit control. Use Modified to determine whether the user changed the Text property of the edit control. Modified is only reset to False when you assign a value to the Text property. In particular, it is not reset when the control receives focus.

ParentWindow#

Reference to parent’s underlying control.

PasteFromClipboard()#

Pastes the contents of the Clipboard into edit control, replacing the current selection. Use PasteFromClipboard to replace the selected text with the contents of the Clipboard, or, if no text is selected, to insert the contents of the Clipboard at the cursor. If the Clipboard is empty, or if it does not contain anything in CF_TEXT format, PasteFromClipboard does nothing.

Note: Calling PasteFromClipboard does the same thing as sending the edit control a WM_PASTE message.

ReadOnly#

Determines whether the user can change the text of the edit control. To restrict the edit control to display only, set the ReadOnly property to true. Set ReadOnly to false to allow the contents of the edit control to be edited. Setting ReadOnly to true ensures that the text is not altered, while still allowing the user to select text. The selected text can then be manipulated by the application, or copied to the Clipboard.

SelLength#

Specifies the number of characters (bytes) that are selected. Read SelLength to determine the length, in bytes, of the selected text. This is the same as the number of characters, unless you are using a multi-byte character set. Set SelLength to change the selection to consist of the first SelLength bytes starting at SelStart.

Note: Setting SelLength to a value greater than the number of characters from SelStart to the end of the text results in the selection of all characters from SelStart to the end of the text. Reading SelLength immediately after setting it to a value greater than the number of available characters returns the number of characters actually selected, not the value that was just set.

SelStart#

Specifies the position of the first selected character in the text. Read SelStart to determine the position of the first selected character, where 0 indicates the first character. If there is no selected text, SelStart indicates the position of the cursor. Set SelStart to remove the current selection and position the cursor just before the indicated character. To select a particular range of the text, first set SelStart to position the cursor, and then set SelLength to extend the selection.

SelText#

Specifies the selected portion of the edit control’s text. Read SelText to determine the value of the selected text. Set SelText to replace the selected text with a new string. If there is no selection, but the edit control has focus, set SelText to insert a new string into the text at the cursor.

SelectAll()#

Selects all text in the edit control. Use SelectAll to select all text in the edit control. To select only part of the text, use the SelStart and SelLength properties.

SetFocus()#

Gives the input focus to the control.

SetSelText(Value: string)#

Sets the SelText property. SetSelText is the property access method for the SelText property.

SetSelTextBuf(Buffer: PWideChar)#

Replaces the selected text with a null-terminated string. Use SetSelTextBuf to replace the current selection by the contents of the null-terminated string pointed to by Buffer. If no text is selected, the contents of Buffer are inserted at the cursor. SetSelTextBuf does the same thing as setting the SelText property, except that it takes a pointer to a char type rather than a string.

Showing#

Indicates whether the control is showing on the screen.

TabStop#

Determines whether the user can tab to a control. Use the TabStop to allow or disallow access to the control using the Tab key. If TabStop is True, the control is in the tab order. If TabStop is False, the control is not in the tab order and the user cannot press the TAB key to move to the control.

Note: TabStop is not meaningful for a form unless the form assigns another form to be its parent.

Text#

Contains a text string associated with the control. Use the Text property to read the Text of the control or to specify a new string for the Text value. By default, Text is the control name. For edit controls and memos, the Text appears within the control. For combo boxes, the Text is the content of the edit control portion of the combo box.

Note: Controls that display text use either the Caption property or the Text property to specify the text value. Which property is used depends on the type of control. In general, Caption is used for text that appears as a window title or label, while Text is used for text that appears as the content of a control.

TextHint#

A hint or message to be displayed when the Text property is empty. Use TextHint to cue the user on what kind of entry is expected in the text field. Runtime themes must be enabled.

Code Examples StdCtrlsProp (Delphi) StdCtrlsProp (C++)

Undo()#

Backs out all changes in the undo buffer. Call Undo to cancel all changes made to the Text property since the last call to the ClearUndo method. If ClearUndo was never called, Undo rolls back all changes. To determine whether there are any changes in the undo buffer, check the CanUndo property.