[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 713

type TCustomEdit = class(TWinControl) end;

protected

Type

  TEmulatedTextHintStatus = (

  thsHidden,

  thsShowing,

  thsChanging

);

  FEmulatedTextHintStatus: TEmulatedTextHintStatus;

  class procedure WSRegisterClass; override;

  

Registers this component class with the current WidgetSet.

  function CanShowEmulatedTextHint; virtual;

  function CreateEmulatedTextHintFont; virtual;

  procedure CalculatePreferredSize(); override;

  

Override this method to return the preferred height and width.

  procedure CreateParams(); override;

  procedure InitializeWnd; override;

  procedure TextChanged; override;

  

Handles changes of the Text property.

  procedure FontChanged(); override;

  procedure Change; virtual;

  procedure DoEnter; override;

  

Invokes the OnEnter handler, then selects the entire text when AutoSelect is True.

  procedure DoExit; override;

  function GetCaretPos; virtual;

  function GetNumbersOnly; virtual;

  function GetReadOnly; virtual;

  function GetSelLength; virtual;

  function GetSelStart; virtual;

  function GetSelText; virtual;

  function GetTextHint; virtual;

  procedure SetCaretPos(); virtual;

  procedure SetEchoMode(); virtual;

  procedure SetNumbersOnly(); virtual;

  procedure SetReadOnly(); virtual;

  procedure SetSelLength(); virtual;

  procedure SetSelStart(); virtual;

  procedure SetSelText(); virtual;

  procedure SetTextHint(); virtual;

  function ChildClassAllowed(); override;

  

Returns True if the given class is allowed for child controls.

  class function GetControlClassDefaultSize; override;

  procedure MouseUp(); override;

  

Invokes the OnMouseUp handler.

  procedure RealSetText(); override;

  

Sets the Caption property.

  function RealGetText; override;

  procedure KeyUpAfterInterface(); override;

  procedure WMChar(); message;

  

Handler for message sent by the widget, after it has handled the keypress itself.

  procedure CMWantSpecialKey(); message;

  procedure WndProc(); override;

  procedure ShouldAutoAdjust(); override;

  procedure WMSetFocus(); message;

  procedure WMKillFocus(); message;

  property AutoSelect: Boolean; [rw]

  

If True, the edit control will select all its text when it receives focus or when the Enter key is pressed.

  property AutoSelected: Boolean; [rw]

  

True when the text selection was established automatically.

  property ParentColor: Boolean;

  

If true, the Color of the control will be the same as the one from the Parent. Default is true.

public

  constructor Create(); override;

  procedure Clear;

  

Deletes all text.

  procedure SelectAll;

  

Selects the entire text in the control.

  procedure ClearSelection; virtual;

  

Deletes (removes) the selected text.

  procedure CopyToClipboard; virtual;

  

Copies the selected text into 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, possibly replacing the selected text.

  procedure Undo; virtual;

  

Reverts the last edit action.

  property Alignment: TAlignment; [rw]

  

The horizontal adjustment of the text - left, right, or centered.

  property AutoSize: Boolean;

  

TCustomEdit defaults to True

  property BorderStyle: TBorderStyle;

  

Allows to show a border (line) around the control,

  property CanUndo: Boolean; [r]

  

Indicates whether recent changes can be reverted.

  property CaretPos: TPoint; [rw]

  

The position of the text cursor.

  property CharCase: TEditCharCase; [rw]

  

Allows to force the text into all upper or lower case.

  property EchoMode: TEchoMode; [rw]

  

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

  property HideSelection: Boolean; [rw]

  

Allows to hide the selection, when the control doesn't have the focus.

  property MaxLength: Integer; [rw]

  

The maximum length of the text; zero for unlimited.

  property Modified: Boolean; [rw]

  

True when the text has changed.

  property NumbersOnly: Boolean; [rw]

  property OnChange: TNotifyEvent; [rw]

  

Event handler for any change in text.

  property PasswordChar: Char; [rw]

  

Allows to obfuscate 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]

  

Prevents the user from changing the text.

  property SelLength: Integer; [rw]

  

The number of currently selected characters.

  property SelStart: Integer; [rw]

  

The zero-based index of the first character in the selection.

  property SelText: string; [rw]

  

The selected text in the edit box.

  property TabOrder: TTabOrder;

  

Determines the sequence of controls, reachable when the user presses the Tab key.

  property TabStop: Boolean;

  

Allows the user to navigate to this control, by pressing the Tab key.

  property Text: TCaption;

  

The text in the edit box.

  property TextHint: TTranslateString; [rw]

  

Default text shown when the Text property is empty and control has no focus.

  property TextHintFontColor: TColor; [rw] deprecated ;

  property TextHintFontStyle: TFontStyles; [rw] deprecated ;

Inheritance

TCustomEdit

  

The base class for controls presenting editable text.

|

TWinControl

  

The base class for controls which can contain other (child) controls.

|

TControl

  

The base class for visible controls.

|

TLCLComponent

  

The base class for LCL components associated with widgets.

|

TComponent

?

TObject

Description

This class implements various visual attributes of the control and its contained text, as well as simple editing and clipboard operations.

Text attributes (bold, italic...) are not supported.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.