IncrementalSearch

This property of combo boxes and list boxes determines whether typing a series of keystrokes accumulates the characters or jumps to a series of different items while searching.

Usage

oObject.IncrementalSearch = lIsIncremental
lIsIncremental = oObject.IncrementalSearch
When IncrementalSearch is off (.F.), each time you type a character, the list or combo jumps to an item beginning with that character. This is the Windows way (well, the Windows 3.1 way—the Windows 95 interface is smarter than that) and we've always hated it.In the FoxPro (and Windows 95) way, each character you type is added to a search string and gets you closer and closer to the item you're looking for. This feature is called "Incremental Search" because you get a little bit closer to the one you want with each keystroke. Setting IncrementalSearch to .T. gives you this behavior and is the default.Of course, eventually you'd like to be able to start over. How long this takes is controlled by, of all things, the system variable _DBLCLICK (which also controls the amount of time between clicks to have two clicks considered a double-click, hence its name). If the length of time specified by _DBLCLICK elapses, the search string is discarded and you start over. We recommend you give your users control over the "incremental search clear" setting because some people type fast and others need longer. Since there's no reason why your users should want this tied to double-click speed, your best bet is probably to change _DBLCLICK in the GotFocus of combos and lists, and reset it in LostFocus. It will, of course, affect double-clicking while those controls have focus, but it's the best we can do until (or is that unless?) Microsoft decides to give us independent control over this one.When a combo box is set to Style 2 (drop-down), IncrementalSearch also applies to the "keyboard steering" feature that lets you move through the list without opening the drop-down.

Example

ThisForm.cboMyCombo.IncrementalSearch = .T.

See Also

ComboBox, _DblClick, ListBox, Sorted


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .