输入值后自动离开字段

Automatically leave field after value is entered

我正在 Visual FoxPro 中创建一个表单,用户将在其中输入大量只有一个字符值的值。这样用户就不必在每次按键后按 Tab 键,我想设置表单,以便在输入值后光标自动转到下一个字段。

执行此操作的好方法是什么?

确保你有 SET CONFIRM OFF

来自帮助文件:

SET CONFIRM ON | OFF
...
OFF Specifies that the user can exit a text box by typing past the last character in the text box. The insertion point, when it reaches the last character in a text box, moves to the next control, and the bell is sounded (if SET BELL is set to ON).

OFF is the default value of SET CONFIRM.

SET CONFIRM OFF also affects menu items and menu titles. If SET CONFIRM is set to OFF, the user can choose an item from a menu or a menu title in a menu bar by pressing the key corresponding to the first letter of the menu item or title. (When SET CONFIRM is set to ON, this action only selects the menu item or title.)

我制作了一个带有两个文本框的简单表单,并验证了在输入一个字符后,它会跳转到下一个文本框。

Herb 的回答是正确的,但请记住,光标将跳转到 TAB 顺序中的下一个字段。
因此,如果您以其他顺序输入文本框字段,则可能需要重新排序 TAB。
要验证您是否拥有所需的 TAB 顺序,请在 VFP 开发环境中打开表单,从菜单中单击查看 - Tab 顺序 - 交互分配。然后使用鼠标,您可以重新排序文本框的 TAB 设置。

另请注意,TAB Order 还包括其他 Form 对象,例如 Buttons、Grids 等

祝你好运