Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

EditBox

The EditBox is Visual FoxPro’s answer to the @ … EDIT of Xbase-gone-by. It provides an area for freeform text editing, complete with scrolling, tabs and so forth.

An edit box can be based on a memo field, a character field or variable, or just a literal character string.

Property

Value

Purpose

AddLineFeeds

Logical

Indicates whether a linefeed character (Chr(10)) should be added after each return character (Chr(13)) when data is transferred to the ControlSource or the control loses focus.

AllowTabs

Logical

Indicates whether Tabs can be entered.

Format

Character

Specifies Xbase-style formatting functions.

HideSelection

Logical

Indicates whether selected text retains its highlight when focus moves to another control.

MaxLength

Numeric

Specifies the maximum number of characters that can be entered.

ScrollBars

Numeric

Indicates whether the edit box has scrollbars.

SelStart, SelLength

Numeric

Indicate the starting position and length of the selected text.

SelText

Character

The currently selected text.

Like other controls, EditBox acquired the MouseEnter and MouseLeave events in VFP 7.

Example

* Set an edit box (Edit1) to have no scroll bars,
* to accept tabs and to accept no more than 50 characters.
ThisForm.Edit1.ScrollBars = 0
ThisForm.Edit1.AllowTabs = .T.
ThisForm.Edit1.MaxLength = 50

If you need to format the text within the edit box, allowing things like italics or bold, consider using the RichText ActiveX control instead.

See Also

AddLineFeeds, AllowTabs, Format, HideSelection, MaxLength, MouseEnter, MouseLeave, ScrollBars, SelLength, SelStart, SelText, Textbox