ex.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
TAB Function Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' This example uses the TAB function with the PRINT and PRINT USING
' statements to center a text string and position a page number at a
' particular location on an 80-column screen.
 
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
 
 CLS                               ' Clear the screen
 INPUT "What is your full name "; Name$
 PRINT
 PRINT "Do you want the page number <C>entered or <R>ight-justified? "
 DO
     Answer$ = UCASE$(INKEY$)
 LOOP UNTIL Answer$ = "C" OR Answer$ = "R"
 CLS
 PageNumber% = INT(RND * 10)
' Divide the length of Name$ by 2 and subtract from screen center point.
 PRINT TAB(40 - (LEN(Name$) \2)); Name$
 LOCATE 23, 1
 IF Answer$ = "C" THEN
     PRINT TAB(35); USING "Page ##"; PageNumber%
 ELSE
     PRINT TAB(72); USING "Page ##"; PageNumber%
 END IF
 END