home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pcmagazi / 1992 / 02 / color.sc < prev    next >
Text File  |  1991-09-24  |  3KB  |  76 lines

  1. ;**********************************************************************
  2. ; COLOR.SC                  Paradox procedure to pop-up a color chart
  3. ;**********************************************************************
  4.  
  5. CREATELIB "X:\\PDOXPRIV\\Mylib"            ; Create library
  6.  
  7. ;----------------------------------------------------------------------
  8. ; ClrChrt()
  9. ; Paradox Procedure to draw a color/attrib chart
  10. ;----------------------------------------------------------------------
  11. PROC CLOSED ClrChrt()
  12.    USEVARS Autolib
  13.    q = 0
  14.    i = 0
  15.    n = 0
  16.  
  17.    CANVAS OFF
  18.    Box(4, 5, 21, 73, "████████", 127, True)  ; Draw box for chart
  19.  
  20.    @ 5, 7
  21.    FOR i FROM 0 to 15                        ; outer loop - does rows
  22.       FOR n FROM 0 to 15                     ; inner loop - does columns
  23.          STYLE ATTRIBUTE q                   ; set attribute (color)
  24.                                     ; write attribute code in attribute color
  25.          @ ROW(),COL() ?? FORMAT("W4,EZ",q)
  26.  
  27.          q = q + 1                           ; increment attribute
  28.       ENDFOR                                 ; loop inside
  29.       @ROW() + 1, 7                          ; increment row
  30.    ENDFOR                                    ; loop outside
  31.    STYLE ATTRIBUTE 113
  32.    @ 4, 29 ?? " Paradox Color Chart "
  33.  
  34.    CANVAS ON                                 ; display canvas
  35.    n = GETCHAR()                             ; hold until user presses
  36.                                              ; a key.
  37. ENDPROC
  38.  
  39. ;----------------------------------------------------------------------
  40. ; Box (TROW, TCOL, BROW, BCOL, char, color, shadow)
  41. ; Paradox procedure to draw a filled box with optional drop shadow.
  42. ;----------------------------------------------------------------------
  43. PROC CLOSED Box (TROW, TCOL, BROW, BCOL, char, color, shadow)
  44.    tlc      = SUBSTR(char, 1, 1)
  45.    top      = SUBSTR(char, 2, 1)
  46.    trc      = SUBSTR(char, 3, 1)
  47.    side     = SUBSTR(char, 4, 1)
  48.    blc      = SUBSTR(char, 5, 1)
  49.    brc      = SUBSTR(char, 6, 1)
  50.    fillchar = SUBSTR(char, 7, 1)
  51.  
  52.    wide    = BCOL - TCOL - 2
  53.    high    = BROW - TROW - 1
  54.    i       = 0
  55.  
  56.    IF shadow = TRUE THEN           ; Draw shadow or don't
  57.       PAINTCANVAS ATTRIBUTE 0+7 TROW+1, TCOL+1, BROW+1, BCOL+1
  58.    ENDIF
  59.  
  60.    STYLE ATTRIBUTE color           ; Set color as passed in 'color' parm
  61.  
  62.    ; Draw each box row as a string made up of the box chars
  63.    ; and the fillchar. First, the top row, then a loop to do all
  64.    ; the interim rows - and finally the bottom row.
  65.  
  66.    @TROW, TCOL ?? tlc + FILL(top,wide) + trc
  67.  
  68.    FOR i FROM 1 TO high
  69.            @TROW + i, TCOL ?? side + FILL(fillchar,wide) + side
  70.    ENDFOR
  71.  
  72.    @BROW, TCOL ?? blc + FILL(top, wide) + brc
  73. ENDPROC
  74.  
  75. WRITELIB "X:\\PDOXPRIV\\Mylib" ClrChrt, Box
  76.