5748378 [rkeene@sledge /home/rkeene/devel/archive/quickbasic]$ cat -n mswndow7.bas
   1: 'Textbx is very short ,but its very powerful +
   2: 'Fonts are made using the letter ASCII charectar code +
   3: 'Syntax is explained +
   4: 'Buttons Dont have text -
   5: 'Background Color selector +
   6: 
   7: 
   8: 
   9: 
  10: 
  11: 
  12: DECLARE SUB LoadFont (f$)
  13: DECLARE SUB Font (t$)
  14: DECLARE SUB BackGround (C!)
  15: DECLARE SUB Sleep2 (t!)
  16: DECLARE SUB Window2 (length!, height!, row!, column!)
  17: DECLARE SUB Textbx (SX!, SY!, EX!, EY!, t$, r!, l!, pw$, tb$, del)
  18: DECLARE SUB Button1 (X!, Y!, S!, P!, tle$)
  19: DIM SHARED Txt(255) AS STRING
  20: SCREEN 12
  21: LoadFont "C:\ROY1.FNT"
  22: '            ³
  23: '          Fontspec
  24: '
  25: ' Fontspec - Font drive:path\filename (e.g. C:\Font1.Fnt or Font1.Fnt )
  26: '+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  27: BackGround 1
  28: '          ³
  29: '         Color
  30: '
  31: ' Color - Color of Background
  32: '+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  33: 
  34: Window2 350, 426, 10, 20
  35: '        ³    ³    ³  ÀÄÄÄ¿
  36: '        ³    ³    ÀÄÄÄ¿  ÀÄÄÄÄ¿
  37: '    Length  Height  StartX  StartY
  38: '
  39: ' Length - How long (left to right) the window is
  40: ' Heigth - How tall (up and down) the window is
  41: ' StartX - Starting X position (pixels down from top)
  42: ' StartY - Starting Y position (pixels right of top)
  43: '
  44: '+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  45: '
  46: Textbx 40, 40, 290, 55, Txt$, 0, 1, "", "NOTHING", 1
  47: '       ³   ³   ³    ³    ³   ³  ³   ³      ³      ÀÄÄÄÄ¿
  48: '       ³   ³   ³    ³    ³   ³  ³   ÀÄÄ¿   ÀÄÄÄÄÄÄÄÄÄ¿ ³
  49: '       ³   ³   ³    ÀÄÄÄ¿ÀÄÄ¿ÀÄ¿ÀÄÄÄÄÄ¿ÀÄÄÄÄÄÄÄÄÄÄÄÄ¿³ ÀÄÄÄÄÄÄÄÄ¿
  50: '       ³   ÀÄ¿ ÀÄÄÄÄÄ¿  ÀÄÄ¿ÀÄ¿ÀÄÄÄÄÄ¿ÀÄÄÄÄ¿        ³ÀÄÄÄÄÄÄÄÄ¿ ÀÄÄÄÄÄ¿
  51: '   StartX  StartY  EndX  EndY Text  Read  Max_Len Pass_Char TextBx  Overite
  52: '
  53: ' StartX    - Starting X position (pixels down from top)
  54: ' StartY    - Starting Y position (pixels right of top)
  55: ' EndX      - Ending X position (pixels down from top)
  56: ' EndY      - Ending Y position (pixels right of top)
  57: ' Text      - Text read from box
  58: ' Read      - Read text from box (1 to read,0 to just put box)
  59: ' Max_Len.  - Maximum length of text
  60: ' Pass_Char - Charectar to replace typed text ("" for normal text)
  61: ' TextBx    - Text to be in box
  62: ' Overrite  - Can the user overrite TextBx (1 = yes 0 = no)
  63: '
  64: '+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  65: Button1 50, 100, 56, 0, "   G"
  66: '        ³   ³    ³  ÀÄÄÄ¿  ÀÄÄ¿
  67: '        ³   ÀÄ¿  ÀÄÄÄÄÄ¿ÀÄÄ¿  ÀÄ¿
  68: '     StartY  StartX  Size Press Title
  69: '
  70: ' StartX - Starting X position (pixels down from top)
  71: ' StartY - Starting Y position (pixels right of top)
  72: ' Size   - Size Of Button
  73: ' Press  - 1 or 0 (1 if pressed ,0 if not pressed)
  74: ' Title  - Text on Button
  75: '+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  76: DO UNTIL INKEY$ = CHR$(13)
  77: Sleep2 .3
  78: Button1 50, 100, 56, 1, "   G"
  79: Sleep2 .3
  80: Button1 50, 100, 56, 0, "   G"
  81: LOOP
  82: 32 Textbx 40, 40, 290, 55, t$, 1, 16, "#", "ROY ", 0
  83: Textbx 40, 60, 290, 75, t$, 1, 16, "", "ROY ", 1
  84: 
  85: SUB BackGround (C)
  86: LINE (-1, -1)-(640, 480), C, BF
  87: END SUB
  88: 
  89: SUB Button1 (X, Y, S, P, tle$)
  90: IF P = 0 THEN clr1 = 15: clr2 = 8 ELSE clr1 = 8: clr2 = 15
  91: EX = X + S: EY = Y + S
  92: LINE (X, Y)-(EX, EY), 7, BF
  93: LINE (X, Y)-(EX, EY), 0, B
  94: LINE (X + 5, Y + 5)-(EX - 5, EY - 5), 7, BF
  95: LINE (X + 4, Y + 4)-(EX - 4, EY - 4), 0, B
  96: LINE (X, EY)-(X + 4, EY - 4), 0
  97: LINE (EX, Y)-(EX - 4, Y + 4), 0
  98: PAINT (X + 1, Y + 1), clr1, 0
  99: PAINT (EX - 1, EY - 1), clr2, 0
 100: END SUB
 101: 
 102: SUB Font (t$)
 103: DRAW "C0"
 104: FOR qww = 1 TO LEN(t$)
 105: DRAW "X" + VARPTR$(Txt(ASC(MID$(t$, qww, 1)))): GOTO 1011
 106: DRAW "C0BRE8G4L4R8L4H4F8H4E4G8E4U4D8BR6"
 107: 1011 NEXT qww
 108: END SUB
 109: 
 110: SUB LoadFont (f$)
 111: OPEN f$ FOR INPUT AS #1: t = 0
 112: DO UNTIL EOF(1)
 113: LINE INPUT #1, a$
 114: Txt(t) = a$
 115: t = t + 1
 116: LOOP
 117: END SUB
 118: 
 119: SUB SCapt (FIL$)
 120: OPEN FIL$ FOR OUTPUT AS #1 LEN = 10000
 121: FOR X = 0 TO 639
 122: FOR Y = 0 TO 479
 123: vv$ = CHR$(POINT(X, Y) + 32)
 124: PRINT #1, vv$; : PSET (X, Y), 15
 125: IF INKEY$ = "" THEN  ELSE CLOSE 1: EXIT SUB
 126: NEXT Y
 127: NEXT X
 128: CLOSE 1
 129: END SUB
 130: 
 131: SUB Sleep2 (t)
 132: a = TIMER
 133: DO UNTIL TIMER >= a + t: LOOP
 134: 
 135: 
 136: END SUB
 137: 
 138: SUB SLoad (FIL$)
 139: OPEN FIL$ FOR RANDOM AS #1
 140: FOR X = 0 TO 639
 141: FOR Y = 0 TO 479
 142: GET #1, Y + 1 * (X + 1), clr$
 143: IF INKEY$ = "" THEN  ELSE CLOSE 1: EXIT SUB
 144: IF EOF(1) THEN CLOSE 1: PSET (X, Y), clr%: EXIT SUB
 145: PSET (X, Y), ASC(clr$) - 32
 146: 10 NEXT Y
 147: NEXT X
 148: END SUB
 149: 
 150: SUB Textbx (SX, SY, EX, EY, t$, r, l, pw$, tb$, del)
 151: IF LEN(tb$) > l AND r = 1 THEN tb$ = MID$(tb$, 1, l)
 152: t$ = tb$: W = LEN(tb$)
 153: IF del = 1 THEN ds = 0 ELSE ds = LEN(tb$)
 154: IF LEN(pw$) > 1 THEN pw$ = LEFT$(pw$, 1)
 155: LINE (SX - 1, SY - 1)-(EX + 1, EY + 1), 0, B
 156: LINE (SX, SY)-(EX, EY), 15, BF
 157: MX$ = "M" + STR$(SX + 2) + "," + STR$(EY - 2)
 158: DRAW "BX" + VARPTR$(MX$)
 159: IF pw$ = "" THEN Font tb$ ELSE Font STRING$(LEN(tb$), pw$)
 160: IF r = 1 THEN  ELSE EXIT SUB
 161: 12 a$ = INKEY$
 162: IF a$ = "" GOTO 12
 163: IF a$ = CHR$(8) THEN IF LEN(t$) - ds = 0 THEN GOTO 12 ELSE t$ = LEFT$(t$, LEN(t$) - 1): W = W - 1: LINE (SX - 1, SY - 1)-(EX + 1, EY + 1), 0, B: LINE (SX, SY)-(EX, EY), 15, BF: DRAW "BX" + VARPTR$(MX$): IF pw$ = "" THEN Font UCASE$(t$): GOTO 12 ELSE Font STRING$(LEN(t$), pw$): GOTO 12
 164: IF a$ = CHR$(13) THEN EXIT SUB
 165: IF W = l THEN GOTO 12
 166: t$ = t$ + a$: W = W + LEN(a$)
 167: B$ = UCASE$(a$)
 168: IF pw$ = "" THEN Font B$ ELSE Font pw$
 169: GOTO 12
 170: END SUB
 171: 
 172: SUB Window2 (length, height, row, column)
 173: LINE (column, row)-(column + length, row + height), 0, B
 174: FOR i% = 1 TO 2
 175: row = row + 1: column = column + 1: height = height - 1: length = length - 1
 176: LINE (column, row)-(column + length, row), 7
 177: LINE (column, row)-(column, row + height), 7
 178: NEXT i%
 179: row = row + 1: column = column + 1: height = height - 1: length = length - 1
 180: LINE (column, row)-(column + length, row), 0
 181: LINE (column, row)-(column, row + height), 0
 182: LINE (column, row)-(column + 18, row + 18), 7, BF
 183: LINE (column, row)-(column + 18, row + 18), 0, B
 184: LINE (column + 18, row - 2)-(column + 18, row + 5), 0
 185: LINE (column - 2, row + 18)-(column + 5, row + 18), 0
 186: LINE (column + 5, row + 7)-(column + 13, row + 9), 15, BF: LINE (column + 5, row + 7)-(column + 13, row + 9), 0, B
 187: LINE (column + 14, row + 7)-(column + 14, row + 9), 8
 188: LINE (column + 6, row + 10)-(column + 14, row + 10), 8, B
 189: LINE (column + 18, row)-(column + length, row + 18), 9, BF
 190: LINE (column + 18, row)-(column + length, row + 18), 0, B
 191: LINE (column + length, row - 3)-(column + length + 2, row + height), 7, BF
 192: LINE (column + length, row - 3)-(column + length + 3, row + height), 0, B
 193: LINE (column + length, row - 2)-(column + length, row - 1), 7
 194: LINE (column + length - 18, row - 2)-(column + length - 18, row - 1), 0
 195: LINE (column + length, row + 18)-(column + length + 2, row + 18), 0
 196: LINE (column, row + height - 3)-(column + length, row + height - 3), 0, B
 197: LINE (column, row + height - 2)-(column + length + 2, row + height), 7, BF
 198: LINE (column - 2, row + height)-(column + length + 2, row + height), 0, B
 199: LINE (column - 2, row + height - 18)-(column, row + height - 18), 0
 200: LINE (column + length - 2, row + height - 18)-(column + length + 2, row + height - 18), 0
 201: LINE (column + 18, row + height)-(column + 18, row + height - 2), 0
 202: LINE (column + length - 18, row + height)-(column + length - 18, row + height - 2), 0
 203: LINE (column + 1, row + 19)-(column + length - 1, row + height - 4), 7, BF
 204: END SUB
 205: 
5748379 [rkeene@sledge /home/rkeene/devel/archive/quickbasic]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2000-05-09 21:05:50