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:


Edit a single line of text.


Edit multiple lines of text.


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


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


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


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


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


Specifies whether the user is allowed to change the text.


Limits the number of characters in simple edit controls.


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