bas7ex.hlp (Topic list)
CHR$ Function Programming Example
                       Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
'This example uses the CHR$ function to display graphics characters in the
'extended character set, using these characters to draw boxes on the screen.
 
DEFINT A-Z
'Display two double-sided boxes.
CLS
CALL DBox(5,22,18,40)
CALL DBox(1,4,4,50)
END
 
SUB DBox (Urow%, Ucol%, Lrow%, Lcol%) STATIC
   'Parameters:
   '  Urow%, Ucol% : Row and column of upper-left corner.
   '  Lrow%, Lcol% : Row and column of lower-right corner.
   CONST ULEFTC=201, URIGHTC=187, LLEFTC=200, LRIGHTC=188
   'Constants for extended ASCII graphic characters.
   CONST VERTICAL=186, HORIZONTAL=205
 
   'Draw top of box.
   LOCATE Urow%, Ucol% : PRINT CHR$(ULEFTC);
   LOCATE ,Ucol%+1 : PRINT STRING$(Lcol%-Ucol%,CHR$(HORIZONTAL));
   LOCATE ,Lcol% : PRINT CHR$(URIGHTC);
   'Draw body of box.
   FOR I=Urow%+1 TO Lrow%-1
      LOCATE I,Ucol% : PRINT CHR$(VERTICAL);
      LOCATE  ,Lcol% : PRINT CHR$(VERTICAL);
   NEXT I
   'Draw bottom of box.
   LOCATE Lrow%, Ucol% : PRINT CHR$(LLEFTC);
   LOCATE ,Ucol%+1 : PRINT STRING$(Lcol%-Ucol%,CHR$(HORIZONTAL));
   LOCATE ,Lcol% : PRINT CHR$(LRIGHTC);
END SUB