Microsoft KB Archive/40889

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 16:56, 18 July 2020 by 3155ffGd (talk | contribs) (importing KB archive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


How to PRINT Superscript/Subscript Letters in Mac QuickBASIC

Article ID: 40889

Article Last Modified on 1/9/2003



APPLIES TO

  • Microsoft QuickBasic Compiler for Macintosh 1.0



This article was previously published under Q40889

SUMMARY

The sample program below shows how to subscript and superscript a character on the screen from a Macintosh QuickBASIC program using the CALL MOVE and CALL TEXTSIZE routines. The CALL MOVE routine is used to change the relative vertical position of the text, and the CALL TEXTSIZE routine is to reduce the text size.

MORE INFORMATION

The following is a code example:

superscript% = 1
subscript% = 0
PRINT "hi"
PRINT "hi";
CALL ssscript(subscript%,"hh")
PRINT "hi"
END

SUB ssscript(script%,text$) STATIC
 default%=0
 SELECT CASE script%        'determine script type
  CASE 0                    'subscript
   y1delta%=+2
   y2delta%=-2
  CASE 1                    'superscript
   y1delta%=-2
   y2delta%=+2
  CASE ELSE
   PRINT "INVALID ARGUMENT"
   EXIT SUB
 END SELECT

 CALL MOVE (0,y1delta%)        'move either up or down 2
 CALL TEXTSIZE(8)              'reduce text size
 PRINT text$;                  'display text without return
 CALL MOVE (0,y2delta%)        'return to original position
 CALL TEXTSIZE(default%)       'return to default text size
ENDSUB
                


Additional query words: MQuickB

Keywords: KB40889