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.

SET CONFIRM, Set(“Confirm”)

SET CONFIRM determines whether or not the user has to press a cursor-movement key to complete a text entry. In some cases, it also controls whether you can choose a menu item by just pressing the first letter or if you need to press Enter, too.

Usage

SET CONFIRM ON | OFF
cConfirm = SET( "CONFIRM" )

With CONFIRM ON, the user must explicitly complete an entry in a text box or spinner by pressing Enter, Tab or a navigation key. When CONFIRM is OFF, filling a text box or spinner (by entering either as many characters as the InputMask calls for or as many as will fit) moves the cursor to the beginning of the next input field automatically.

We can make pretty good arguments for each setting of CONFIRM. In heads-down data entry, with CONFIRM OFF, it’s easy to overwrite data accidentally. On the other hand, with CONFIRM ON, you have an extra keystroke after each field. You need to figure out which of these techniques makes sense in your application and then do it the same way throughout. One factor to consider is whether the user will normally completely fill each field. In that case, CONFIRM OFF can be a real time-saver and the user should be aware of the consequences of overlong entries. If some fields get filled and others don’t, CONFIRM OFF can be very confusing since the user sometimes has to use Tab or Enter and other times doesn’t. Best of all, of course, is to let each user decide which setting works for her.

With menus, SET CONFIRM only makes a difference on menu popups with no defined hotkeys. In that case, CONFIRM OFF means pressing the first letter of an item immediately executes the first item beginning with that letter. This can be confusing to users unless you’re careful not to start two items on the same menu with the same letter—the first one catches all the keystrokes, and the second one can only be chosen by navigating to it and pressing Enter. (Actually, it’s not quite that simple. Whenever you press the key, the next occurrence of an item beginning with that letter is chosen. If you happen to be already sitting on such an item, it doesn’t get chosen. The next item with that letter is picked.) With CONFIRM OFF, pressing the first letter simply moves focus to that item.

In a Windows world, a popup where no item contains a hotkey is so rare that this feature is likely to be irrelevant in just about every application.

SET CONFIRM is scoped to individual data sessions, so it’s no longer good enough to set it in your application’s startup code.

See Also

Define Popup, Set, Spinner, TextBox