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.

HideSelection

This property determines whether selected text remains highlighted when focus moves to another control. The default is for the highlight to disappear when focus changes.

Usage

oObject.HideSelection = lHideIt
lHideIt = oObject.HideSelection

The controls that support selection of text are text boxes, edit boxes, spinners and combo boxes (only in combo mode—not as drop-downs). For some reason, combo boxes didn’t have a HideSelection property in VFP 3, but that was remedied in VFP 5.

HideSelection doesn't affect spinners at all. That's because spinners don't remember their selection properly as soon as they lose focus. See SelLength for the details on this bug.

You’ll usually want to leave HideSelection set to .T. Things get confusing when too many highlights appear. Setting HideSelection to .F. (that is, letting all the highlights show) seems most useful when you want to perform some operation on the selected text.

Example

ThisForm.Edit1.HideSelection = .F.

See Also

ComboBox, EditBox, SelLength, SelStart, SelText, Spinner, TextBox