RAD Studio |  |

Edit Controls
See Also
Collapse All

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:
TEdit | Edit a single line of text.
TMemo | Edit multiple lines of text.
TMaskEdit | Adhere to a particular format, such as a postal code or phone number.
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.

TMemo and TRichEdit 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

TEdit

TMemo

TMaskEdit

TRichEdit

Working with Text in Controls

Edit Controls

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!