Author Topic: Basic FORM filler  (Read 3285 times)

0 Members and 1 Guest are viewing this topic.

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Basic FORM filler
« on: April 02, 2021, 02:17:30 am »
Moved from Discussion to here

appends text with a cursor. Can move text with left or right arrow keys
 can append numbers at present. Very basic code.

I see my vpos should have been hpos . i really dont understand the AND OR at the end of the PUTs but it does seem to work

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1024, 768, 32)
  2. DIM CurON(300) AS INTEGER
  3. DIM CurOFF(300) AS INTEGER
  4. LINE (0, 0)-(12, 12), _RGB32(255, 255, 255), BF
  5. GET (0, 7)-(9, 9), CurON()
  6. LINE (0, 0)-(12, 12), _RGB32(0, 0, 0), BF
  7. GET (0, 7)-(9, 9), CurOFF()
  8.  
  9. vpos = 100
  10. h& = _NEWIMAGE(1024, 768, 32)
  11.  
  12. Msg = " FORM FILLER"
  13.  
  14.  
  15. _PRINTSTRING (vpos, 10), Msg
  16.  
  17.  
  18.  
  19. PUT (vpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  20.  
  21.  
  22.     DO
  23.  
  24.         _LIMIT 100
  25.  
  26.         kh = _KEYHIT
  27.         IF kh > 0 THEN EXIT DO
  28.  
  29.     LOOP
  30.  
  31.     IF kh > 47 AND kh < 58 THEN
  32.  
  33.         PUT (vpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  34.         'SLEEP
  35.         Msg = Msg + CHR$(kh)
  36.         _PRINTSTRING (vpos, 10), Msg
  37.  
  38.         PUT (vpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  39.     END IF
  40.  
  41.     IF kh = 27 THEN EXIT DO
  42.     IF kh = 19200 AND vpos > 0 THEN 'left arrow
  43.         PUT (vpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  44.         vpos = vpos - 1
  45.         _PRINTSTRING (vpos, 10), Msg
  46.         PUT (vpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  47.     END IF
  48.  
  49.     IF kh = 19712 AND vpos < _WIDTH - LEN(Msg) THEN 'right arrow
  50.         PUT (vpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  51.         vpos = vpos + 1
  52.         _PRINTSTRING (vpos, 10), Msg
  53.         PUT (vpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  54.     END IF
  55.  
  56.     _SOURCE h&
  57.     _DEST 0
  58.  
  59.     _PUTIMAGE
  60.  

Some bugs fixed in this one

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1024, 768, 32)
  2. DIM CurON(300) AS INTEGER
  3. DIM CurOFF(300) AS INTEGER
  4. LINE (0, 0)-(12, 12), _RGB32(255, 255, 255), BF
  5. GET (0, 7)-(9, 9), CurON()
  6. LINE (0, 0)-(12, 12), _RGB32(0, 0, 0), BF
  7. GET (0, 7)-(9, 9), CurOFF()
  8.  
  9. Hpos = 0
  10. H = _NEWIMAGE(1024, 768, 32)
  11.  
  12. Msg = " FORM FILLER"
  13.  
  14.  
  15. _PRINTSTRING (Hpos, 10), Msg
  16.  
  17.  
  18.  
  19. PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  20.  
  21.  
  22.     DO
  23.         _LIMIT 100
  24.         kh = _KEYHIT
  25.         IF kh > 0 THEN EXIT DO
  26.  
  27.     LOOP
  28.  
  29.     IF kh > 47 AND kh < 58 THEN
  30.  
  31.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(Msg) + 12 < _WIDTH THEN
  32.             PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  33.             Msg = Msg + CHR$(kh)
  34.             _PRINTSTRING (Hpos, 10), Msg
  35.             PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  36.         END IF
  37.  
  38.     END IF
  39.  
  40.     IF kh = 27 THEN EXIT DO
  41.     IF kh = 19200 AND Hpos > 0 THEN 'left arrow
  42.         PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  43.         Hpos = Hpos - 1
  44.         _PRINTSTRING (Hpos, 10), Msg
  45.         PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  46.     END IF
  47.  
  48.     IF kh = 19712 AND Hpos < _WIDTH - (_PRINTWIDTH(Msg) + 10) THEN 'right arrow
  49.         PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  50.         Hpos = Hpos + 1
  51.         _PRINTSTRING (Hpos, 10), Msg
  52.         PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  53.     END IF
  54.  
  55.     _SOURCE H
  56.     _DEST 0
  57.     _PUTIMAGE
  58.  


Can enter most any character now.  Backspace works

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1024, 768, 32)
  2. DIM CurON(300) AS INTEGER
  3. DIM CurOFF(300) AS INTEGER
  4. LINE (0, 0)-(12, 12), _RGB32(255, 255, 255), BF
  5. GET (0, 7)-(9, 9), CurON()
  6. LINE (0, 0)-(12, 12), _RGB32(0, 0, 0), BF
  7. GET (0, 7)-(9, 9), CurOFF()
  8.  
  9. Hpos = 0
  10. H = _NEWIMAGE(1024, 768, 32)
  11.  
  12. Msg = " FORM FILLER"
  13.  
  14.  
  15. _PRINTSTRING (Hpos, 10), Msg
  16.  
  17.  
  18.  
  19. PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  20.  
  21.  
  22.     DO
  23.         _LIMIT 100
  24.         kh = _KEYHIT
  25.         IF kh > 0 THEN EXIT DO
  26.  
  27.     LOOP
  28.  
  29.     IF kh > 31 AND kh < 127 THEN 'append
  30.  
  31.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(Msg) + 12 < _WIDTH THEN
  32.             PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  33.             Msg = Msg + CHR$(kh)
  34.             _PRINTSTRING (Hpos, 10), Msg
  35.             PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  36.         END IF
  37.  
  38.     END IF
  39.  
  40.  
  41.     IF kh = 8 AND LEN(Msg) > 1 THEN 'BACKSPACE
  42.  
  43.         PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  44.         Msg = LEFT$(Msg, LEN(Msg) - 1)
  45.         _PRINTSTRING (Hpos, 10), Msg + " "
  46.         PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  47.  
  48.     END IF
  49.  
  50.  
  51.  
  52.  
  53.  
  54.     IF kh = 27 THEN EXIT DO
  55.     IF kh = 19200 AND Hpos > 0 THEN 'left arrow
  56.         PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  57.         Hpos = Hpos - 1
  58.         _PRINTSTRING (Hpos, 10), Msg
  59.         PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  60.     END IF
  61.  
  62.     IF kh = 19712 AND Hpos < _WIDTH - (_PRINTWIDTH(Msg) + 10) THEN 'right arrow
  63.         PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  64.         Hpos = Hpos + 1
  65.         _PRINTSTRING (Hpos, 10), Msg
  66.         PUT (Hpos + _PRINTWIDTH(Msg), 10 + _FONTHEIGHT - 2), CurON(), OR
  67.     END IF
  68.  
  69.     _SOURCE H
  70.     _DEST 0
  71.     _PUTIMAGE
  72.  
« Last Edit: April 03, 2021, 12:06:18 am by NOVARSEG »

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Basic FORM filler
« Reply #1 on: April 02, 2021, 11:03:50 pm »
The next thing to do is word wrap.  This is tricky because each line of text is stored in an array. The text array must work with append, insert, delete, backspace, home, end , enter

The text array is movable anywhere on the screen with arrow keys

The width of text array is adjustable.    Line spacing is adjustable.

This code shows a very basic word wrap that almost works with backspace.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1024, 768, 32)
  2. DIM oldHpos AS INTEGER
  3. DIM HLine AS INTEGER
  4. DIM CurON(300) AS INTEGER
  5. DIM CurOFF(300) AS INTEGER
  6.  
  7. DIM Lspace AS INTEGER ' line spacing
  8. Lspace = 12 ' pixels
  9. LINE (0, 0)-(12, 12), _RGB32(255, 255, 255), BF
  10. GET (0, 7)-(9, 9), CurON()
  11. LINE (0, 0)-(12, 12), _RGB32(0, 0, 0), BF
  12. GET (0, 7)-(9, 9), CurOFF()
  13.  
  14. Hpos = 0
  15. Vpos = 10
  16. oldHpos = 0
  17. H = _NEWIMAGE(1024, 768, 32)
  18.  
  19. DIM msg(50) AS STRING
  20. msg(0) = " FORM FILLER"
  21.  
  22.  
  23. _PRINTSTRING (Hpos, 10), msg(HLine)
  24.  
  25.  
  26.  
  27. PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  28.  
  29.     LL1:
  30.     DO
  31.         _LIMIT 100
  32.         kh = _KEYHIT
  33.         IF kh > 0 THEN EXIT DO
  34.  
  35.     LOOP
  36.  
  37.     IF kh > 31 AND kh < 127 THEN 'append
  38.  
  39.  
  40.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 < _WIDTH THEN
  41.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  42.             msg(HLine) = msg(HLine) + CHR$(kh)
  43.             _PRINTSTRING (Hpos, (Vpos + HLine * Lspace)), msg(HLine)
  44.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  45.         END IF
  46.  
  47.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 >= _WIDTH THEN
  48.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  49.             HLine = HLine + 1: GOTO LL1
  50.         END IF
  51.  
  52.  
  53.     END IF
  54.  
  55.  
  56.     IF kh = 8 AND LEN(msg(HLine)) > 1 THEN 'BACKSPACE
  57.  
  58.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  59.         msg(HLine) = LEFT$(msg(HLine), LEN(msg(HLine)) - 1)
  60.         _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine) + " "
  61.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  62.  
  63.     END IF
  64.  
  65.     IF kh = 27 THEN EXIT DO
  66.  
  67.     IF kh = 19200 AND Hpos > 0 THEN 'left arrow
  68.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  69.         Hpos = Hpos - 1
  70.         _PRINTSTRING (Hpos, 10), msg(HLine)
  71.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  72.     END IF
  73.  
  74.     IF kh = 19712 AND Hpos < _WIDTH - (_PRINTWIDTH(msg(HLine)) + 10) THEN 'right arrow
  75.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  76.         Hpos = Hpos + 1
  77.         _PRINTSTRING (Hpos, 10), msg(HLine)
  78.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  79.     END IF
  80.  
  81.     _SOURCE H
  82.     _DEST 0
  83.     _PUTIMAGE
  84.  

Backspace works now. Still some bugs to work out when moving text from left most screen position. Text is not movable as an array yet.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1024, 768, 32)
  2. DIM oldHpos AS INTEGER
  3. DIM HLine AS INTEGER
  4. DIM CurON(300) AS INTEGER
  5. DIM CurOFF(300) AS INTEGER
  6.  
  7. DIM Lspace AS INTEGER ' line spacing
  8. Lspace = 15 ' pixels
  9. LINE (0, 0)-(12, 12), _RGB32(255, 255, 255), BF
  10. GET (0, 7)-(9, 9), CurON()
  11. LINE (0, 0)-(12, 12), _RGB32(0, 0, 0), BF
  12. GET (0, 7)-(9, 9), CurOFF()
  13.  
  14. Hpos = 0
  15. Vpos = 10
  16. oldHpos = 0
  17. H = _NEWIMAGE(1024, 768, 32)
  18.  
  19. DIM msg(50) AS STRING
  20. msg(0) = "FORM FILLER"
  21.  
  22.  
  23. _PRINTSTRING (Hpos, 10), msg(HLine)
  24.  
  25.  
  26.  
  27. PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  28.  
  29.     LL1:
  30.     DO
  31.         _LIMIT 100
  32.         kh = _KEYHIT
  33.         IF kh > 0 THEN EXIT DO
  34.  
  35.     LOOP
  36.  
  37.     IF kh > 31 AND kh < 127 THEN 'append
  38.  
  39.  
  40.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 < _WIDTH THEN
  41.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  42.             msg(HLine) = msg(HLine) + CHR$(kh)
  43.             _PRINTSTRING (Hpos, (Vpos + HLine * Lspace)), msg(HLine)
  44.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  45.         END IF
  46.  
  47.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 >= _WIDTH THEN
  48.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  49.             HLine = HLine + 1: GOTO LL1
  50.         END IF
  51.  
  52.  
  53.     END IF
  54.  
  55.  
  56.     '****  'BACKSPACE
  57.     IF kh = 8 AND LEN(msg(HLine)) = 0 THEN
  58.         'erases cursor before a line feed up
  59.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  60.  
  61.         IF HLine > 0 THEN HLine = HLine - 1
  62.     END IF
  63.  
  64.     IF kh = 8 AND LEN(msg(HLine)) > 0 THEN
  65.  
  66.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  67.         msg(HLine) = LEFT$(msg(HLine), LEN(msg(HLine)) - 1)
  68.         _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine) + " "
  69.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  70.  
  71.     END IF
  72.  
  73.     '****
  74.  
  75.  
  76.  
  77.     IF kh = 27 THEN EXIT DO
  78.  
  79.     IF kh = 19200 AND Hpos > 0 THEN 'left arrow
  80.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  81.         Hpos = Hpos - 1
  82.         _PRINTSTRING (Hpos, 10), msg(HLine)
  83.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  84.     END IF
  85.  
  86.     IF kh = 19712 AND Hpos < _WIDTH - (_PRINTWIDTH(msg(HLine)) + 10) THEN 'right arrow
  87.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  88.         Hpos = Hpos + 1
  89.         _PRINTSTRING (Hpos, 10), msg(HLine)
  90.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  91.     END IF
  92.  
  93.     _SOURCE H
  94.     _DEST 0
  95.     _PUTIMAGE
  96.  

"Enter" key works now and a bug was fixed, Text arrays still not movable as a paragraph

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1025, 768, 32)
  2. DIM oldHpos AS INTEGER
  3. DIM HLine AS INTEGER
  4. DIM CurON(300) AS INTEGER
  5. DIM CurOFF(300) AS INTEGER
  6.  
  7. DIM Lspace AS INTEGER ' line spacing
  8. Lspace = 15 ' pixels
  9. LINE (0, 0)-(12, 12), _RGB32(255, 255, 255), BF
  10. GET (0, 7)-(9, 9), CurON()
  11. LINE (0, 0)-(12, 12), _RGB32(0, 0, 0), BF
  12. GET (0, 7)-(9, 9), CurOFF()
  13.  
  14. Hpos = 0
  15. Vpos = 10
  16. oldHpos = 0
  17. H = _NEWIMAGE(1024, 768, 32)
  18.  
  19. DIM msg(50) AS STRING
  20. msg(0) = "FORM FILLER"
  21.  
  22.  
  23. _PRINTSTRING (Hpos, 10), msg(HLine)
  24.  
  25.  
  26.  
  27. PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  28.  
  29.     LL1:
  30.     DO
  31.         _LIMIT 100
  32.         kh = _KEYHIT
  33.         IF kh > 0 THEN EXIT DO
  34.  
  35.     LOOP
  36.  
  37.  
  38.     IF kh = 13 THEN 'ENTER
  39.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  40.         HLine = HLine + 1
  41.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  42.         GOTO LL1 'line feed
  43.     END IF
  44.  
  45.  
  46.     IF kh > 31 AND kh < 127 THEN 'append
  47.  
  48.  
  49.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 < _WIDTH THEN
  50.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  51.             msg(HLine) = msg(HLine) + CHR$(kh)
  52.             _PRINTSTRING (Hpos, (Vpos + HLine * Lspace)), msg(HLine)
  53.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  54.         END IF
  55.  
  56.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 >= _WIDTH THEN
  57.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  58.             HLine = HLine + 1: GOTO LL1 'line feed
  59.         END IF
  60.  
  61.  
  62.     END IF
  63.  
  64.  
  65.     '****  'BACKSPACE
  66.     IF kh = 8 AND LEN(msg(HLine)) = 0 THEN
  67.         'erases cursor before a line feed up
  68.  
  69.         IF HLine > 0 THEN
  70.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  71.         END IF
  72.  
  73.         IF HLine > 0 THEN HLine = HLine - 1
  74.     END IF
  75.  
  76.     IF kh = 8 AND LEN(msg(HLine)) > 0 THEN
  77.  
  78.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  79.         msg(HLine) = LEFT$(msg(HLine), LEN(msg(HLine)) - 1)
  80.         _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine) + " "
  81.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  82.  
  83.     END IF
  84.  
  85.     '****
  86.  
  87.  
  88.  
  89.     IF kh = 27 THEN EXIT DO
  90.  
  91.     IF kh = 19200 AND Hpos > 0 THEN 'left arrow
  92.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  93.         Hpos = Hpos - 1
  94.         _PRINTSTRING (Hpos, 10), msg(HLine)
  95.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  96.     END IF
  97.  
  98.     IF kh = 19712 AND Hpos < _WIDTH - (_PRINTWIDTH(msg(HLine)) + 10) THEN 'right arrow
  99.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  100.         _PRINTSTRING (Hpos, 10), " "
  101.         Hpos = Hpos + 1
  102.         _PRINTSTRING (Hpos, 10), msg(HLine)
  103.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  104.     END IF
  105.  
  106.     _SOURCE H
  107.     _DEST 0
  108.     _PUTIMAGE
  109.  
« Last Edit: April 03, 2021, 12:03:20 am by NOVARSEG »

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Basic FORM filler
« Reply #2 on: April 03, 2021, 01:10:52 am »
 Entire text array moves right .  Useful for moving a paragraph.

Try right arrow, enter key and backspace

Need to try a green background and save to a file.

A lot more code to do.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1025, 768, 32)
  2. DIM oldHpos AS INTEGER
  3. DIM HLine AS INTEGER
  4. DIM CurON(300) AS INTEGER
  5. DIM CurOFF(300) AS INTEGER
  6.  
  7. DIM Lspace AS INTEGER ' line spacing
  8. Lspace = 20 ' pixels
  9. LINE (0, 0)-(12, 12), _RGB32(255, 255, 255), BF
  10. GET (0, 7)-(9, 9), CurON()
  11. LINE (0, 0)-(12, 12), _RGB32(0, 0, 0), BF
  12. GET (0, 7)-(9, 9), CurOFF()
  13.  
  14. Hpos = 0 'horizontal pixel  position
  15. Vpos = 10 'vertical pixel  position
  16. oldHpos = 0
  17. H = _NEWIMAGE(1024, 768, 32)
  18.  
  19. DIM msg(50) AS STRING
  20. msg(0) = "FORM FILLER"
  21.  
  22.  
  23. _PRINTSTRING (Hpos, 10), msg(HLine)
  24.  
  25. '_PUTIMAGE
  26.  
  27.  
  28. PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  29.  
  30.     LL1:
  31.     DO
  32.         _LIMIT 100
  33.         kh = _KEYHIT
  34.         IF kh > 0 THEN EXIT DO
  35.  
  36.     LOOP
  37.  
  38.  
  39.     IF kh = 13 THEN 'ENTER
  40.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  41.         HLine = HLine + 1
  42.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  43.         GOTO LL1 'line feed
  44.     END IF
  45.  
  46.  
  47.     IF kh > 31 AND kh < 127 THEN 'append
  48.  
  49.  
  50.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 < _WIDTH THEN
  51.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  52.             msg(HLine) = msg(HLine) + CHR$(kh)
  53.             _PRINTSTRING (Hpos, (Vpos + HLine * Lspace)), msg(HLine)
  54.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  55.         END IF
  56.  
  57.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 >= _WIDTH THEN
  58.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  59.             HLine = HLine + 1: GOTO LL1 'line feed
  60.         END IF
  61.  
  62.  
  63.     END IF
  64.  
  65.  
  66.     '****  'BACKSPACE
  67.     IF kh = 8 AND LEN(msg(HLine)) = 0 THEN
  68.  
  69.         IF HLine > 0 THEN 'erases cursor before a line feed up
  70.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  71.         END IF
  72.  
  73.         IF HLine > 0 THEN HLine = HLine - 1
  74.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  75.         GOTO LL1
  76.     END IF
  77.  
  78.     IF kh = 8 AND LEN(msg(HLine)) > 0 THEN
  79.  
  80.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  81.         msg(HLine) = LEFT$(msg(HLine), LEN(msg(HLine)) - 1)
  82.         _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine) + " "
  83.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  84.  
  85.     END IF
  86.  
  87.     '****  end BACKSPACE
  88.  
  89.     IF kh = 27 THEN EXIT DO
  90.  
  91.     IF kh = 19200 AND Hpos > 0 THEN 'left arrow
  92.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurOFF(), AND
  93.         Hpos = Hpos - 1
  94.         _PRINTSTRING (Hpos, 10), msg(HLine)
  95.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  96.     END IF
  97.  
  98.  
  99.     '****
  100.     IF kh = 19712 AND Hpos < _WIDTH - (_PRINTWIDTH(msg(HLine)) + 10) THEN 'right arrow
  101.         HLine = 0
  102.         DO
  103.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  104.             _PRINTSTRING (Hpos, Vpos + HLine * Lspace), " "
  105.             Hpos = Hpos + 1
  106.             _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine)
  107.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  108.             Hpos = Hpos - 1 '- 1 because this is an array.
  109.  
  110.             IF msg(HLine + 1) = "" THEN
  111.                 Hpos = Hpos + 1
  112.                 EXIT DO
  113.             END IF
  114.  
  115.             HLine = HLine + 1
  116.  
  117.         LOOP
  118.     END IF
  119.     '****
  120.  
  121.     '   _SOURCE H
  122.     '  _DEST 0
  123.     ' _PUTIMAGE
  124.  

left arrow works now

move paragraph left or right

move paragraph up down next

Code: QB64: [Select]
  1.  SCREEN _NEWIMAGE(1024, 768, 32)
  2. DIM oldHpos AS INTEGER
  3. DIM HLine AS INTEGER
  4. DIM CurON(300) AS INTEGER
  5. DIM CurOFF(300) AS INTEGER
  6.  
  7. DIM Lspace AS INTEGER ' line spacing
  8. Lspace = 20 ' pixels
  9. LINE (0, 0)-(12, 12), _RGB32(255, 255, 255), BF
  10. GET (0, 7)-(9, 9), CurON()
  11. LINE (0, 0)-(12, 12), _RGB32(0, 0, 0), BF
  12. GET (0, 7)-(9, 9), CurOFF()
  13.  
  14. Hpos = 0 'horizontal pixel  position
  15. Vpos = 10 'vertical pixel  position
  16. oldHpos = 0
  17. H = _NEWIMAGE(1024, 768, 32)
  18.  
  19. DIM msg(50) AS STRING
  20. msg(0) = "FORM FILLER"
  21.  
  22.  
  23. _PRINTSTRING (Hpos, 10), msg(HLine)
  24.  
  25. '_PUTIMAGE
  26.  
  27.  
  28. PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  29.  
  30.     LL1:
  31.     DO
  32.         _LIMIT 100
  33.         kh = _KEYHIT
  34.         IF kh > 0 THEN EXIT DO
  35.  
  36.     LOOP
  37.  
  38.  
  39.     IF kh = 13 THEN 'ENTER
  40.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  41.         HLine = HLine + 1
  42.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  43.         GOTO LL1 'line feed
  44.     END IF
  45.  
  46.  
  47.     IF kh > 31 AND kh < 127 THEN 'append
  48.  
  49.  
  50.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 < _WIDTH THEN
  51.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  52.             msg(HLine) = msg(HLine) + CHR$(kh)
  53.             _PRINTSTRING (Hpos, (Vpos + HLine * Lspace)), msg(HLine)
  54.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  55.         END IF
  56.  
  57.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 >= _WIDTH THEN
  58.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  59.             HLine = HLine + 1: GOTO LL1 'line feed
  60.         END IF
  61.  
  62.  
  63.     END IF
  64.  
  65.  
  66.     '****  'BACKSPACE
  67.     IF kh = 8 AND LEN(msg(HLine)) = 0 THEN
  68.  
  69.         IF HLine > 0 THEN 'erases cursor before a line feed up
  70.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  71.         END IF
  72.  
  73.         IF HLine > 0 THEN HLine = HLine - 1
  74.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  75.         GOTO LL1
  76.     END IF
  77.  
  78.     IF kh = 8 AND LEN(msg(HLine)) > 0 THEN
  79.  
  80.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  81.         msg(HLine) = LEFT$(msg(HLine), LEN(msg(HLine)) - 1)
  82.         _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine) + " "
  83.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  84.  
  85.     END IF
  86.  
  87.     '****  end BACKSPACE
  88.  
  89.     IF kh = 27 THEN EXIT DO
  90.  
  91.     IF kh = 19200 AND Hpos > 0 THEN 'left arrow
  92.  
  93.         HLine = 0
  94.         DO
  95.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  96.             _PRINTSTRING (Hpos, Vpos + HLine * Lspace), " "
  97.             Hpos = Hpos - 1
  98.             _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine)
  99.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  100.             Hpos = Hpos + 1 '- 1 because this is an array.
  101.  
  102.             IF msg(HLine + 1) = "" THEN
  103.                 Hpos = Hpos - 1
  104.                 EXIT DO
  105.             END IF
  106.  
  107.             HLine = HLine + 1
  108.  
  109.         LOOP
  110.  
  111.  
  112.     END IF
  113.  
  114.  
  115.     '****
  116.     IF kh = 19712 AND Hpos < _WIDTH - (_PRINTWIDTH(msg(HLine)) + 10) THEN 'right arrow
  117.         HLine = 0
  118.         DO
  119.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  120.             _PRINTSTRING (Hpos, Vpos + HLine * Lspace), " "
  121.             Hpos = Hpos + 1
  122.             _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine)
  123.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  124.             Hpos = Hpos - 1 '- 1 because this is an array.
  125.  
  126.             IF msg(HLine + 1) = "" THEN
  127.                 Hpos = Hpos + 1
  128.                 EXIT DO
  129.             END IF
  130.  
  131.             HLine = HLine + 1
  132.  
  133.         LOOP
  134.     END IF
  135.     '****
  136.  
  137.     '   _SOURCE H
  138.     '  _DEST 0
  139.     ' _PUTIMAGE
  140.  

some bugs fixed.  up down arrows notworking yet.


Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1025, 768, 32)
  2. DIM oldHpos AS INTEGER
  3. DIM HLine AS INTEGER
  4. DIM maxHline AS INTEGER
  5. DIM CurON(300) AS INTEGER
  6. DIM CurOFF(300) AS INTEGER
  7.  
  8. DIM Lspace AS INTEGER ' line spacing
  9. Lspace = 20 ' pixels
  10. LINE (0, 0)-(12, 12), _RGB32(255, 255, 255), BF
  11. GET (0, 7)-(9, 9), CurON()
  12. LINE (0, 0)-(12, 12), _RGB32(0, 0, 0), BF
  13. GET (0, 7)-(9, 9), CurOFF()
  14.  
  15. Hpos = 0 'horizontal pixel  position
  16. Vpos = 10 'vertical pixel  position
  17. oldHpos = 0
  18. H = _NEWIMAGE(1024, 768, 32)
  19.  
  20. DIM msg(50) AS STRING
  21. msg(0) = "FORM FILLER"
  22.  
  23.  
  24. _PRINTSTRING (Hpos, 10), msg(HLine)
  25.  
  26. '_PUTIMAGE
  27.  
  28.  
  29. PUT (Hpos + _PRINTWIDTH(msg(HLine)), 10 + _FONTHEIGHT - 2), CurON(), OR
  30.  
  31.     LL1:
  32.     DO
  33.         _LIMIT 100
  34.         kh = _KEYHIT
  35.         IF kh > 0 THEN EXIT DO
  36.  
  37.     LOOP
  38.     ' PRINT kh
  39.  
  40.     IF kh = 13 THEN 'ENTER
  41.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  42.         HLine = HLine + 1 'line feed
  43.         maxHline = HLine
  44.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  45.         GOTO LL1
  46.     END IF
  47.  
  48.  
  49.     IF kh > 31 AND kh < 127 THEN 'append
  50.  
  51.  
  52.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 < _WIDTH THEN
  53.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  54.             msg(HLine) = msg(HLine) + CHR$(kh)
  55.             _PRINTSTRING (Hpos, (Vpos + HLine * Lspace)), msg(HLine)
  56.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  57.         END IF
  58.  
  59.         IF Hpos + _PRINTWIDTH(CHR$(kh)) + _PRINTWIDTH(msg(HLine)) + 12 >= _WIDTH THEN
  60.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  61.             HLine = HLine + 1: GOTO LL1 'line feed
  62.         END IF
  63.  
  64.  
  65.     END IF
  66.  
  67.  
  68.     '****  'BACKSPACE
  69.     IF kh = 8 AND LEN(msg(HLine)) = 0 THEN
  70.  
  71.         IF HLine > 0 THEN 'erases cursor before a line feed up
  72.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  73.         END IF
  74.  
  75.         IF HLine > 0 THEN HLine = HLine - 1
  76.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  77.         GOTO LL1
  78.     END IF
  79.  
  80.     IF kh = 8 AND LEN(msg(HLine)) > 0 THEN
  81.  
  82.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  83.         msg(HLine) = LEFT$(msg(HLine), LEN(msg(HLine)) - 1)
  84.         _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine) + " "
  85.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  86.  
  87.     END IF
  88.  
  89.     '****  end BACKSPACE
  90.  
  91.     IF kh = 27 THEN EXIT DO
  92.  
  93.  
  94.     IF kh = 20480 THEN
  95.         HLine = 0
  96.     END IF
  97.  
  98.  
  99.     IF kh = 19200 AND Hpos > 0 THEN 'left arrow
  100.  
  101.         HLine = 0
  102.         DO
  103.             'PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  104.             _PRINTSTRING (Hpos, Vpos + HLine * Lspace), " "
  105.             Hpos = Hpos - 1
  106.             _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine)
  107.             'PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  108.             Hpos = Hpos + 1 '- 1 because this is an array.
  109.  
  110.             IF maxHline = HLine THEN
  111.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  112.                 Hpos = Hpos - 1
  113.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  114.  
  115.                 EXIT DO
  116.             END IF
  117.  
  118.             HLine = HLine + 1
  119.  
  120.         LOOP
  121.  
  122.  
  123.     END IF
  124.  
  125.  
  126.     '****
  127.     IF kh = 19712 AND Hpos < _WIDTH - (_PRINTWIDTH(msg(HLine)) + 10) THEN 'right arrow
  128.         HLine = 0
  129.         DO
  130.             'PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  131.             _PRINTSTRING (Hpos, Vpos + HLine * Lspace), " "
  132.             Hpos = Hpos + 1
  133.             _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine)
  134.             'PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  135.             Hpos = Hpos - 1 '- 1 because this is an array.
  136.  
  137.             IF maxHline = HLine THEN
  138.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  139.                 Hpos = Hpos + 1
  140.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  141.  
  142.                 EXIT DO
  143.             END IF
  144.  
  145.             HLine = HLine + 1
  146.  
  147.         LOOP
  148.     END IF
  149.     '****
  150.  
  151.     '   _SOURCE H
  152.     '  _DEST 0
  153.     ' _PUTIMAGE
  154.  
  155.  
« Last Edit: April 03, 2021, 02:11:55 am by NOVARSEG »

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Basic FORM filler
« Reply #3 on: April 06, 2021, 01:45:13 am »
Move a paragraph around the screen

Fast / slow movement depending on how long the arrow keys are held down.

Back space works.   no something went wrong

bug fixed

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1024, 768, 32)
  2.  
  3.  
  4. DIM maxHline AS INTEGER 'max array index for a cursor and or text
  5. DIM CurON(300) AS INTEGER
  6. DIM CurOFF(300) AS INTEGER
  7.  
  8. DIM ParaWide AS INTEGER 'Tight Left,word wrap paragraph of this width
  9. ParaWide = 25
  10.  
  11. DIM Lspace AS INTEGER ' line spacing
  12. Lspace = 15 ' pixels
  13.  
  14. LINE (0, 0)-(12, 12), _RGB32(255, 255, 255), BF
  15. GET (0, 7)-(9, 9), CurON()
  16. LINE (0, 0)-(12, 12), _RGB32(0, 0, 0), BF
  17. GET (0, 7)-(9, 9), CurOFF()
  18.  
  19. Hpos = 100 'initial horizontal position
  20. Vpos = 100 'initial vertical position
  21. P = 0
  22. DIM msg(50) AS STRING
  23. DIM HLine AS INTEGER
  24. HLine = 0
  25.  
  26. text = "After the latest update, the forms I need to fill are shrunk to 50% without an option to expand to full screen (blows up only a part of the document, the rest is hidden behind the enormously wide margins around the edges of the screen). Previously filled documents also shrunk, but the parts I filled out did not. So now all my tables are all over the place. Please fix                      "
  27.  
  28.     IF P + ParaWide <= LEN(text) THEN
  29.  
  30.         msg(HLine) = MID$(text, P + 1, ParaWide)
  31.         P = P + ParaWide
  32.         _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine)
  33.         maxHline = HLine
  34.         HLine = HLine + 1
  35.  
  36.     END IF
  37.  
  38.     IF P + ParaWide > LEN(text) THEN EXIT DO
  39.  
  40. PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  41.  
  42.     LL1:
  43.  
  44.     DO
  45.         _LIMIT 100
  46.         kh = _KEYHIT
  47.         IF kh > 0 THEN t = 0: EXIT DO
  48.         t = t + 1
  49.         IF t > 5 THEN f1 = 0
  50.     LOOP
  51.  
  52.     IF kh = 27 THEN EXIT DO
  53.  
  54.     '**** ENTER
  55.     IF kh = 13 AND Vpos + (HLine + 1) * Lspace + _FONTHEIGHT + 2 < _HEIGHT THEN
  56.  
  57.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  58.         HLine = HLine + 1
  59.         maxHline = HLine
  60.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  61.         GOTO LL1
  62.  
  63.     END IF
  64.     '****  end enter
  65.  
  66.  
  67.     '**** APPEND
  68.     IF kh > 31 AND kh < 127 THEN
  69.  
  70.         IF LEN(msg(HLine)) < ParaWide THEN
  71.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  72.             msg(HLine) = msg(HLine) + CHR$(kh)
  73.             _PRINTSTRING (Hpos, (Vpos + HLine * Lspace)), msg(HLine)
  74.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  75.         END IF
  76.  
  77.  
  78.         IF LEN(msg(HLine)) >= ParaWide THEN
  79.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurOFF(), AND
  80.  
  81.             HLine = HLine + 1
  82.             maxHline = HLine
  83.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), (Vpos + HLine * Lspace) + _FONTHEIGHT - 2), CurON(), OR
  84.             GOTO LL1
  85.         END IF
  86.  
  87.  
  88.     END IF
  89.     '****  end append
  90.  
  91.  
  92.     '****  'BACKSPACE
  93.     IF kh = 8 AND LEN(msg(HLine)) = 0 THEN
  94.  
  95.         IF HLine > 0 THEN 'erases cursor before a line feed up
  96.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  97.             HLine = HLine - 1
  98.             maxHline = HLine
  99.             PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  100.             GOTO LL1
  101.         END IF
  102.     END IF
  103.  
  104.     IF kh = 8 AND LEN(msg(HLine)) > 0 THEN
  105.  
  106.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  107.         msg(HLine) = LEFT$(msg(HLine), LEN(msg(HLine)) - 1)
  108.         _PRINTSTRING (Hpos, Vpos + HLine * Lspace), msg(HLine) + " "
  109.         PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  110.  
  111.     END IF
  112.  
  113.     '****  end BACKSPACE
  114.  
  115.  
  116.     '****
  117.     IF kh = 20480 AND Vpos + maxHline * Lspace + _FONTHEIGHT + Inc < _HEIGHT THEN 'down arrow
  118.         HLine = 0
  119.         Inc = 1
  120.         DO
  121.             _PRINTSTRING (Hpos, Vpos + (HLine * Lspace)), SPACE$(ParaWide)
  122.             IF maxHline = HLine THEN EXIT DO
  123.             HLine = HLine + 1
  124.         LOOP
  125.  
  126.         IF f1 = 0 THEN f1 = 1: t1! = TIMER
  127.  
  128.         t2! = TIMER
  129.         IF t2! - t1! > .5 THEN
  130.             Inc = 9
  131.             t2! = 0
  132.         END IF
  133.  
  134.         Vpos = Vpos + Inc
  135.         HLine = 0
  136.  
  137.         DO
  138.             _PRINTSTRING (Hpos, Vpos + (HLine * Lspace)), msg(HLine)
  139.  
  140.             IF maxHline = HLine THEN
  141.                 Vpos = Vpos - Inc
  142.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  143.                 Vpos = Vpos + Inc
  144.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  145.                 EXIT DO
  146.             END IF
  147.             HLine = HLine + 1
  148.         LOOP
  149.     END IF
  150.     '****
  151.  
  152.     '****
  153.     IF kh = 18432 AND Vpos > Inc THEN 'up arrow
  154.         HLine = 0
  155.         Inc = 1
  156.         DO
  157.             _PRINTSTRING (Hpos, Vpos + (HLine * Lspace)), SPACE$(ParaWide)
  158.             IF maxHline = HLine THEN EXIT DO
  159.             HLine = HLine + 1
  160.         LOOP
  161.  
  162.         IF f1 = 0 THEN f1 = 1: t1! = TIMER
  163.  
  164.         t2! = TIMER
  165.         IF t2! - t1! > .5 THEN
  166.             Inc = 9
  167.             t2! = 0
  168.         END IF
  169.  
  170.         Vpos = Vpos - Inc
  171.         HLine = 0
  172.  
  173.         DO
  174.             _PRINTSTRING (Hpos, Vpos + (HLine * Lspace)), msg(HLine)
  175.  
  176.             IF maxHline = HLine THEN
  177.                 Vpos = Vpos + Inc
  178.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  179.                 Vpos = Vpos - Inc
  180.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  181.                 EXIT DO
  182.             END IF
  183.  
  184.             HLine = HLine + 1
  185.         LOOP
  186.     END IF
  187.  
  188.     '****
  189.  
  190.     '****
  191.     IF kh = 19200 AND Hpos > Inc THEN 'left arrow
  192.  
  193.         HLine = 0
  194.         Inc = 1
  195.         DO
  196.             _PRINTSTRING (Hpos, Vpos + (HLine * Lspace)), SPACE$(ParaWide)
  197.             IF maxHline = HLine THEN EXIT DO
  198.             HLine = HLine + 1
  199.         LOOP
  200.  
  201.         IF f1 = 0 THEN f1 = 1: t1! = TIMER
  202.  
  203.         t2! = TIMER
  204.         IF t2! - t1! > .5 THEN
  205.             Inc = 9
  206.             t2! = 0
  207.         END IF
  208.  
  209.         Hpos = Hpos - Inc
  210.         HLine = 0
  211.         DO
  212.             _PRINTSTRING (Hpos, Vpos + (HLine * Lspace)), msg(HLine)
  213.             IF maxHline = HLine THEN
  214.                 Hpos = Hpos + Inc
  215.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  216.                 Hpos = Hpos - Inc
  217.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  218.                 EXIT DO
  219.             END IF
  220.             HLine = HLine + 1
  221.         LOOP
  222.     END IF
  223.     '****
  224.  
  225.     '****
  226.  
  227.  
  228.     IF kh = 19712 AND Hpos + _PRINTWIDTH(SPACE$(ParaWide)) + Inc + 8 < _WIDTH THEN 'right arrow
  229.  
  230.         HLine = 0
  231.         Inc = 1
  232.         DO
  233.             _PRINTSTRING (Hpos, Vpos + (HLine * Lspace)), SPACE$(ParaWide)
  234.             IF maxHline = HLine THEN EXIT DO
  235.             HLine = HLine + 1
  236.         LOOP
  237.  
  238.         IF f1 = 0 THEN f1 = 1: t1! = TIMER
  239.  
  240.         t2! = TIMER
  241.         IF t2! - t1! > .5 THEN
  242.             Inc = 9
  243.             t2! = 0
  244.         END IF
  245.  
  246.         Hpos = Hpos + Inc
  247.         HLine = 0
  248.         DO
  249.             _PRINTSTRING (Hpos, Vpos + (HLine * Lspace)), msg(HLine)
  250.             IF maxHline = HLine THEN
  251.                 Hpos = Hpos - Inc
  252.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurOFF(), AND
  253.                 Hpos = Hpos + Inc
  254.                 PUT (Hpos + _PRINTWIDTH(msg(HLine)), Vpos + HLine * Lspace + _FONTHEIGHT - 2), CurON(), OR
  255.                 EXIT DO
  256.             END IF
  257.  
  258.             HLine = HLine + 1
  259.         LOOP
  260.     END IF
  261.  
  262.  





« Last Edit: April 06, 2021, 03:49:46 am by NOVARSEG »

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Basic FORM filler
« Reply #4 on: April 07, 2021, 08:30:48 pm »
 PUT (x,y),array, AND can swap  font color with background color without the use of COLOR statement.

More bugs.




« Last Edit: April 08, 2021, 12:47:55 am by NOVARSEG »