Edit Controls

From RAD Studio
Jump to: navigation, search

Go Up to Text Controls


Edit controls display text to the user and allow the user to enter text. The type of control used for this purpose depends on the size and format of the information.

Use this component: When you want users to do this:

FMX.Edit.TEdit
Vcl.StdCtrls.TEdit

Edit a single line of text.

FMX.Memo.TMemo
Vcl.StdCtrls.TMemo

Edit multiple lines of text.

Vcl.Mask.TMaskEdit

Adhere to a particular format, such as a postal code or phone number.

Vcl.ComCtrls.TRichEdit

Edit multiple lines of text using rich text format (VCL only).



TEdit and TMaskEdit are simple edit controls that include a single line text edit box in which you can type information. When the edit box has focus, a blinking insertion point appears.

You can include text in the edit box by assigning a string value to its Text property. You control the appearance of the text in the edit box by assigning values to its Font property. You can specify the typeface, size, color, and attributes of the font. The attributes affect all of the text in the edit box and cannot be applied to individual characters.

An edit box can be designed to change its size depending on the size of the font it contains. You do this by setting the AutoSize property to True. You can limit the number of characters an edit box can contain by assigning a value to the MaxLength property.

TMaskEdit is a special edit control that validates the text entered against a mask that encodes the valid forms the text can take. The mask can also format the text that is displayed to the user.

Memo and Rich Edit Controls allow the user to add several lines of text.

Edit controls have some of the following important properties:

Edit control properties :

Property Description

Text

Determines the text that appears in the edit box or memo control.

Font

Controls the attributes of text written in the edit box or memo control.

AutoSize

Enables the edit box to dynamically change its height depending on the currently selected font.

ReadOnly

Specifies whether the user is allowed to change the text.

MaxLength

Limits the number of characters in simple edit controls.

SelText

Contains the currently selected (highlighted) part of the text.

SelStart, SelLength

Indicate the position and length of the selected part of the text.



See Also