Microsoft KB Archive/128632

{| = Sample Procedure to Insert Spaces when TAB Key is Pressed =
 * width="100%"|

ID: Q128632

The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a

SUMMARY
Below is a procedure demonstrating how to, within a program, insert spaces when the TAB key is pressed.

MORE INFORMATION
In the SETUP Code of your Screen, OR WHEN clause of an @ ... EDIT, or before a MODIFY MEMO or MODIFY FILE, add the following line to allow access to the program:

ON KEY LABEL TAB DO EMULTAB Below is the contents of EMULTAB.PRG: DEFINE WINDOW NEWTAB FROM 1,1 TO 5,22  && Setup a Window MOVE WINDOW NEWTAB CENTER ACTIVATE WINDOW NEWTAB PUBLIC NUMTAB NUMTAB = 4                               && Give a default of 4 Spaces @1,2 SAY "How Many Spaces?" @2,2 GET NUMTAB READ

RELEASE WINDOW NEWTAB SET PROCEDURE TO EMULTAB ON KEY LABEL TAB DO TABEVAL WITH NUMTAB IN EMULTAB KEYBOARD '{TAB}'

PROCEDURE TABEVAL PARAMETERS TABSIZE

FOR i=1 TO TABSIZE KEYBOARD '{SPACEBAR}' NEXT

ON KEY LABEL TAB DO EMULTAB RETURN CAUTION: The default TAB functionality will be gone until the following command is entered: ON KEY LABEL TAB This is sample code. You may modify it to suit your requirements. Additional reference words: FoxWin 2.50 2.50a 2.50b 2.60 2.60a KBCategory: kbprg kbcode KBSubcategory: FxprgGeneral
 * }