Author Topic: Working on an interface for a wordpad print routine.  (Read 4091 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Working on an interface for a wordpad print routine.
« on: March 15, 2021, 12:23:06 am »
Finished!

Removed the SHELL DIR and replaced it with a database of WordPad fonts.

Here's what works. All mouse functions, including the wheel, arrows up and down, page keys, ctrl+home, ctrl+end, and using keys a-z to go though the alphabet in the fonts drop-down menu.

The "Print' button shows us what the .rtf template will look like.

Oh, for bplus, I added a scroll wheel function to increase and decrease field values.

Code: QB64: [Select]
  1. SCREEN 0, 0, 0, 0
  2. '  1440 twips per inch.
  3. PALETTE 7, 63: COLOR 0, 7: CLS
  4. DIM SHARED gen_var AS my_gen_var
  5. DIM SHARED fndrep AS my_fndrep
  6. DIM SHARED dir AS my_dir
  7. DIM SHARED scrn AS my_scrn
  8. DIM SHARED page AS my_page
  9. DIM SHARED margin AS my_margin
  10. DIM SHARED cursor AS my_cursor
  11. DIM SHARED mb AS my_mb
  12.  
  13. TYPE my_gen_var
  14.     action AS STRING
  15.     chdir_text AS STRING
  16.     undorow AS INTEGER
  17.     undocol AS INTEGER
  18.     undoscr AS INTEGER
  19.     redorow AS INTEGER
  20.     redocol AS INTEGER
  21.     redoscr AS INTEGER
  22.     undoswitch AS INTEGER
  23.     change_initiate AS INTEGER
  24.     vartable AS INTEGER
  25.     locked AS INTEGER
  26.     w1 AS INTEGER
  27.     w2 AS INTEGER
  28.     w3 AS INTEGER
  29.     w4 AS INTEGER
  30.     smode AS INTEGER
  31.  
  32. TYPE my_fndrep
  33.     find_action AS STRING
  34.     find_or_replace AS INTEGER
  35.     ifield AS INTEGER
  36.     noif AS INTEGER
  37.     ifrow AS INTEGER
  38.  
  39. TYPE my_dir
  40.     home AS STRING
  41.     wp AS STRING
  42.     orig AS STRING
  43.  
  44. TYPE my_scrn
  45.     w AS INTEGER
  46.     h AS INTEGER
  47.  
  48. TYPE my_page
  49.     w AS INTEGER
  50.     h AS INTEGER
  51.     c AS INTEGER
  52.  
  53. TYPE my_margin
  54.     t AS INTEGER
  55.     b AS INTEGER
  56.     l AS INTEGER
  57.     r AS INTEGER
  58.  
  59. TYPE my_cursor
  60.     find AS INTEGER
  61.     scbrrow AS INTEGER ' row + scr
  62.     scbrcol AS INTEGER ' POS(0)
  63.     holdscr AS INTEGER ' Holds scr
  64.     holdrow AS INTEGER ' Holds row
  65.     holdscrbx AS INTEGER ' Holds scrb.x
  66.     top AS INTEGER
  67.     bot AS INTEGER
  68.  
  69. TYPE my_mb
  70.     l AS INTEGER
  71.     r AS INTEGER
  72.     m AS INTEGER
  73.     w AS INTEGER
  74.     drag AS INTEGER
  75.     dragon AS INTEGER
  76.  
  77. ' Non shared UDTs
  78.  
  79. TYPE my_scrb
  80.     t AS INTEGER
  81.     b AS INTEGER
  82.     l AS INTEGER
  83.     x AS INTEGER
  84.     i AS INTEGER
  85.     d AS INTEGER
  86.     h AS INTEGER
  87.     s AS INTEGER
  88.     opt AS INTEGER
  89.     adjust AS INTEGER
  90.  
  91. enl% = 13: CALL font_size_setup(enl%)
  92.  
  93. dir.home = _CWD$
  94. IF INSTR(dir.home, "\") = 0 THEN CLS: PRINT "Error in variable formatting for dir.home.": END '''
  95. IF RIGHT$(dir.home, 1) <> "\" THEN dir.home = dir.home + "\"
  96. dir.wp = dir.home: dir.orig = dir.home
  97.  
  98. CALL pageset
  99.  
  100. COLOR 0, 7
  101.  
  102. font_types:
  103. DATA Arial,Arial Black,Arial Narrow,Bahnschrift,Book Antiqua,Bookman Old Style,Bookshelf Symbol 7,Bradley Hand ITC,Calibri,Calibri Light,Calisto MT,Cambria,Cambria Math,Candara,Candara Light,Century,Century Gothic,Comic Sans MS,Consolas,Constantia
  104. DATA Corbel,Corbel Light,Courier,Courier New,Ebrima,Fixedsys,Franklin Gothic Medium,Freestyle Script,French Script MT,Gabriola,Gadugi,Gautami,Georgia,HoloLens MDL2 Assets,Impact,Ink Free,Javanese Text,Juice ITC,Kristen ITC,Leelawadee
  105. DATA Leelawadee UI,Leelawadee UI Semilight,Lucida Console,Lucida Handwriting,Lucida Sans Unicode,Malgun Gothic,Marlett,Microsoft Himalaya,Microsoft JhengHei,Microsoft JhengHei Light,Microsoft JhengHei UI,Microsoft JhengHei UI Light,Microsoft New Tai Lue,Microsoft PhagsPa,Microsoft Sans Serif,Microsoft Tai Le,Microsoft Uighur,Microsoft YaHei,Microsoft YaHei UI,Microsoft YaHei UI Light
  106. DATA Microsoft Yi Baiti,MingLiU,PMingLiU,MingLiU-ExtB,PMingLiU-ExtB,MingLiU_HKSCS,MingLiU_HKSCS-ExtB,Mistral,Modern,Mongolian Baiti,Monotype Corsiva,MS Gothic,MS PGothic,MS Reference Sans Serif,MS Reference Specialty,MS Sans Serif,MS Serif,MS UI Gothic,NSimSun,MT Extra,MV Boli,Myanmar Text
  107. DATA Nirmala UI,Narkisim,Nirmala UI,Nirmala UI Semilight,NSimSun,Palatino Linotype,Papyrus,PMingLiU-ExtB,Pristina,Roman,Script,Segoe MDL2 Assets,Segoe Print,Segoe Script,Segoe UI Black,Segoe UI Emoji,Segoe UI Historic,Segoe UI Light,Segoe UI Semibold,Segoe UI Semilight
  108. DATA Segoe UI Symbol,SimSun,SimSun-ExtB,Sitka Banner,Sitka Display,Sitka Heading,Sitka Small,Sitka Subheading,Sitka Text,Small Fonts,Sylfaen,Symbol,System,Tahoma,Tempus Sans ITC,Terminal,Times New Roman,Trebuchet MS,Verdana,Webdings
  109.  
  110. SUB pageset
  111.     DIM scrb AS my_scrb
  112.  
  113.     gen_var.w1 = 4: gen_var.w2 = 11: gen_var.w3 = 18: gen_var.w4 = 60
  114.     msg$ = " Printer Page Settings "
  115.     msg% = -1
  116.  
  117.     CALL popup(msg$, msg%, button$(), button%, button_index%, text$, config%, mydelay%, mx%, my%, xclose%, yclose%)
  118.  
  119.     smode% = 1 '''''''' Temporary.
  120.     nof% = 8: nob% = 2 ' 8 fileds and two buttons.
  121.     REDIM field_name$(10), fieldx%(10), fieldy%(10), field_size%(10), up_arrowx%(10), up_arrowy%(10), dn_arrowx%(10), dn_arrowy%(10)
  122.     REDIM entry$(10), min_val_entry%(5), max_val_entry%(5)
  123.     field_name$(1) = "Margin Top": field_size%(1) = 5: min_val_entry%(1) = 1: max_val_entry%(1) = 9.5
  124.     field_name$(2) = "Margin Bottom": field_size%(2) = 5: min_val_entry%(2) = 1: max_val_entry%(2) = 9.5
  125.     field_name$(3) = "Margin Left": field_size%(3) = 5: min_val_entry%(3) = 1.25: max_val_entry%(3) = 9.5
  126.     field_name$(4) = "Margin Right": field_size%(4) = 5: min_val_entry%(4) = 1.25: max_val_entry%(4) = 9.5
  127.     field_name$(5) = "Font Size ": field_size%(5) = 5: min_val_entry%(5) = 8: max_val_entry%(5) = 72
  128.     field_name$(6) = "Font Color": field_size%(6) = 5
  129.     field_name$(7) = "Font Type": field_size%(7) = 20
  130.     field_name$(8) = "Print Page Number": field_size%(8) = 1
  131.  
  132.     font_color_data:
  133.     DATA Black,Red,Blue,Green,Grey,EOF
  134.  
  135.     GOSUB starting_values
  136.  
  137.     ' BUTTONS ----------------------------->
  138.     button_text$ = "  Reset  ": bw% = 11: bh% = 2: brow% = 30: bcol% = 94
  139.     GOSUB formatbutton
  140.     button_display$ = "on"
  141.  
  142.     button_text$ = "  Print  ": bw% = 11: bh% = 2: brow2% = 30: bcol2% = 115
  143.     GOSUB formatbutton2
  144.     GOSUB bdisplay
  145.  
  146.     DO
  147.         ''' ss = CSRLIN: rr = POS(0): LOCATE 1, 1: PRINT tabx%; nof% + nob%;: LOCATE ss, rr
  148.         _LIMIT 30
  149.         b$ = INKEY$
  150.  
  151.         IF LEN(b$) THEN
  152.             SELECT CASE smode%
  153.                 CASE 0 ' Pop up not present.
  154.                     IF b$ = CHR$(27) THEN SYSTEM
  155.  
  156.                 CASE 1 ' Pop up active. Drop downs closed.
  157.                     SELECT CASE b$
  158.                         CASE CHR$(27)
  159.                             smode% = 0: SCREEN 0, 0, 0, 0: button_display$ = "off": _DISPLAY: _KEYCLEAR
  160.  
  161.                         CASE CHR$(13)
  162.  
  163.                             SELECT CASE tabx%
  164.                                 CASE 8 ' Print page number.
  165.  
  166.                                     i% = tabx%: GOSUB print_page_num
  167.  
  168.                                 CASE 9 ' Reset.
  169.  
  170.                                     i% = tabx%: GOSUB reset_values
  171.  
  172.                                 CASE 10 ' Print.
  173.  
  174.                                     i% = tabx%: GOSUB print_doc
  175.                             END SELECT
  176.  
  177.                         CASE CHR$(9)
  178.                             tabx% = tabx% + 1
  179.                             IF tabx% > nof% + nob% THEN tabx% = 0
  180.                             tab_trigger% = tabx%
  181.                             _KEYCLEAR: _DELAY .1
  182.  
  183.                         CASE CHR$(0) + "H"
  184.                             IF tabx% THEN
  185.                                 SELECT CASE tabx%
  186.                                     CASE 1 TO 5
  187.                                         up_arrowx%(tabx%) = -ABS(up_arrowx%(tabx%))
  188.  
  189.                                         i% = tabx%: GOSUB up_arrow
  190.  
  191.                                         up_arrowx%(tabx%) = ABS(up_arrowx%(tabx%))
  192.                                         iyy% = CSRLIN: ixx% = POS(0)
  193.                                         _DELAY .05
  194.                                         LOCATE up_arrowy%(tabx%), up_arrowx%(tabx%)
  195.                                         COLOR 11, 1
  196.                                         PRINT CHR$(30);
  197.                                         COLOR 7, 0
  198.                                         LOCATE iyy%, ixx%
  199.                                         _KEYCLEAR
  200.  
  201.                                     CASE ELSE
  202.  
  203.                                 END SELECT
  204.                             END IF
  205.  
  206.                         CASE CHR$(0) + "K"
  207.                             tabx% = tabx% - 1
  208.                             IF tabx% < 0 THEN
  209.                                 tabx% = 0
  210.                             ELSE
  211.                                 tab_trigger% = tabx%
  212.                                 _KEYCLEAR: _DELAY .1
  213.                             END IF
  214.  
  215.                         CASE CHR$(0) + "M"
  216.                             tabx% = tabx% + 1
  217.                             IF tabx% > nof% + nob% THEN
  218.                                 tabx% = 0
  219.                             ELSE
  220.                                 tab_trigger% = tabx%
  221.                                 _KEYCLEAR: _DELAY .1
  222.                             END IF
  223.  
  224.                         CASE CHR$(0) + "P"
  225.                             IF tabx% THEN
  226.                                 SELECT CASE tabx%
  227.                                     CASE 1 TO 5
  228.                                         dn_arrowx%(tabx%) = -ABS(dn_arrowx%(tabx%))
  229.  
  230.                                         i% = tabx%: GOSUB dn_arrow
  231.  
  232.                                         dn_arrowx%(tabx%) = ABS(dn_arrowx%(tabx%))
  233.                                         iyy% = CSRLIN: ixx% = POS(0)
  234.                                         _DELAY .05
  235.                                         LOCATE dn_arrowy%(tabx%), dn_arrowx%(tabx%)
  236.                                         COLOR 11, 1
  237.                                         PRINT CHR$(31);
  238.                                         COLOR 7, 0
  239.                                         LOCATE iyy%, ixx%
  240.  
  241.                                         _KEYCLEAR
  242.  
  243.                                     CASE 6
  244.                                         GOSUB font_color_open_dropdown
  245.  
  246.                                     CASE 7
  247.                                         GOSUB font_type_open_dropdown
  248.  
  249.                                 END SELECT
  250.                             END IF
  251.  
  252.                     END SELECT
  253.  
  254.                 CASE 2 ' Drop down menu is open.
  255.  
  256.                     IF b$ = CHR$(0) + "H" THEN
  257.                         GOSUB close_dropdown
  258.                     END IF
  259.  
  260.             END SELECT
  261.         ELSE
  262.  
  263.             GOSUB poll_mouse
  264.  
  265.         END IF
  266.  
  267.         IF my% = yclose% AND mx% = ABS(xclose%) THEN
  268.             IF mb.l AND l_click% = 0 OR mb.l AND autoclick% THEN GOSUB close_x
  269.         END IF
  270.  
  271.         GOSUB audit_close_x
  272.  
  273.         SELECT CASE smode%
  274.  
  275.             CASE 2
  276.  
  277.                 IF mb.l AND l_click% = 0 AND my% = up_arrowy%(tabx%) AND -mx% = up_arrowx%(tabx%) THEN
  278.                     GOSUB close_dropdown
  279.                 END IF
  280.  
  281.                 GOSUB bdisplay
  282.  
  283.             CASE 1
  284.                 IF mb.l AND l_click% = 0 THEN
  285.  
  286.                     ' Reset button
  287.                     IF mx% >= 47 AND mx% <= 52 AND my% = 19 THEN
  288.  
  289.                         GOSUB reset_values
  290.  
  291.                     END IF
  292.  
  293.                     ' Print button
  294.                     IF mx% >= 58 AND mx% <= 63 AND my% = 19 THEN
  295.  
  296.                         GOSUB print_doc
  297.  
  298.                     END IF
  299.                 END IF
  300.  
  301.                 IF mb.l AND l_click% = 0 OR mb.l AND autoclick% THEN
  302.                     FOR i% = 1 TO nof%
  303.                         IF i% = 8 THEN
  304.                             IF mx% = ABS(fieldx%(i%)) AND my% = fieldy%(i%) THEN
  305.  
  306.                                 GOSUB print_page_num
  307.  
  308.                             END IF
  309.                         END IF
  310.  
  311.                         SELECT CASE i%
  312.                             CASE 1 TO 5
  313.                                 IF up_arrowx%(i%) < 0 OR dn_arrowx%(i%) < 0 THEN
  314.  
  315.                                     IF up_arrowx%(i%) < 0 THEN
  316.  
  317.                                         GOSUB up_arrow
  318.  
  319.                                     ELSE
  320.  
  321.                                         GOSUB dn_arrow
  322.  
  323.                                     END IF
  324.  
  325.                                 END IF
  326.  
  327.                             CASE 6 ' Font color.
  328.                                 IF my% = dn_arrowy%(i%) AND mx% = ABS(dn_arrowx%(i%)) THEN
  329.                                     IF dn_arrowx%(i%) < 0 THEN
  330.                                         GOSUB font_color_open_dropdown
  331.                                     END IF
  332.                                 END IF
  333.  
  334.                             CASE 7
  335.  
  336.                                 IF my% = dn_arrowy%(i%) AND mx% = ABS(dn_arrowx%(i%)) THEN
  337.                                     IF dn_arrowx%(i%) < 0 THEN
  338.                                         GOSUB font_type_open_dropdown
  339.                                     END IF
  340.                                 END IF
  341.  
  342.                         END SELECT
  343.                     NEXT
  344.                 ELSE
  345.                     IF mb.w THEN
  346.                         FOR i% = 1 TO 5
  347.                             IF fieldx%(i%) < 0 THEN
  348.                                 IF mb.w < 0 THEN GOSUB increase_value ELSE GOSUB decrease_value
  349.                                 EXIT FOR
  350.                             END IF
  351.                         NEXT
  352.                     ELSEIF mb.l = 0 THEN
  353.                         autoclick% = 0
  354.                         z1 = TIMER
  355.                     ELSE
  356.                         IF ABS(z1 - TIMER) > .5 THEN autoclick% = -1: z1 = TIMER
  357.                     END IF
  358.                 END IF
  359.  
  360.                 IF tab_trigger% AND tabx% = 9 OR mx% >= 47 AND mx% <= 52 AND my% = 19 THEN
  361.                     GOSUB bhover
  362.                 ELSEIF tab_trigger% AND tabx% = 10 OR mx% >= 58 AND mx% <= 63 AND my% = 19 THEN
  363.                     GOSUB bhover2
  364.                 ELSE
  365.                     GOSUB bdisplay
  366.                 END IF
  367.  
  368.                 IF tab_trigger% OR tab_trigger% = 0 AND mx% <> oldmx% OR tab_trigger% = 0 AND my% <> oldmy% THEN
  369.                     DO
  370.                         IF tab_trigger% THEN
  371.                             iyy% = CSRLIN: ixx% = CSRLIN
  372.                             FOR i% = 1 TO nof%
  373.                                 IF up_arrowx%(i%) < 0 THEN up_arrowx%(i%) = ABS(up_arrowx%(i%)): LOCATE up_arrowy%(i%), up_arrowx%(i%): COLOR 11, 1: PRINT CHR$(30);: COLOR 14, 0: LOCATE iyy%, ixx%
  374.                                 IF dn_arrowx%(i%) < 0 THEN dn_arrowx%(i%) = ABS(dn_arrowx%(i%)): LOCATE dn_arrowy%(i%), dn_arrowx%(i%): COLOR 11, 1: PRINT CHR$(31);: COLOR 14, 0: LOCATE iyy%, ixx%
  375.                             NEXT
  376.                         ELSE
  377.                             FOR i% = 1 TO nof%
  378.                                 IF i% <> 8 THEN ' Exclude non-arrow input field.
  379.                                     IF mx% = up_arrowx%(i%) AND my% = up_arrowy%(i%) OR mx% = dn_arrowx%(i%) AND my% = dn_arrowy%(i%) THEN
  380.  
  381.                                         GOSUB activate_field
  382.  
  383.                                         IF my% = up_arrowy%(i%) AND i% <> 6 AND i% <> 7 THEN
  384.                                             LOCATE up_arrowy%(i%), up_arrowx%(i%)
  385.                                             COLOR 14, 1
  386.                                             PRINT CHR$(30);
  387.                                             up_arrowx%(i%) = ABS(up_arrowx%(i%)) * -1
  388.                                             COLOR 7, 0
  389.                                         ELSE
  390.                                             LOCATE dn_arrowy%(i%), dn_arrowx%(i%)
  391.                                             COLOR 14, 1
  392.                                             PRINT CHR$(31);
  393.                                             dn_arrowx%(i%) = ABS(dn_arrowx%(i%)) * -1
  394.                                             COLOR 7, 0
  395.                                         END IF
  396.                                         EXIT DO
  397.                                     ELSE
  398.                                         IF up_arrowx%(i%) < 0 OR dn_arrowx%(i%) < 0 THEN
  399.                                             iyy% = CSRLIN: ixx% = POS(0)
  400.                                             up_arrowx%(i%) = ABS(up_arrowx%(i%))
  401.                                             dn_arrowx%(i%) = ABS(dn_arrowx%(i%))
  402.                                             COLOR 11, 1
  403.                                             IF up_arrowy%(i%) THEN LOCATE up_arrowy%(i%), up_arrowx%(i%): PRINT CHR$(30);
  404.                                             IF dn_arrowy%(i%) THEN LOCATE dn_arrowy%(i%), dn_arrowx%(i%): PRINT CHR$(31);
  405.                                             LOCATE iyy%, ixx%
  406.                                             GOSUB neutralize_field
  407.                                         END IF
  408.                                     END IF
  409.                                 END IF
  410.                             NEXT
  411.                         END IF
  412.  
  413.                         FOR i% = 1 TO nof%
  414.                             IF fieldx%(i%) < 0 THEN
  415.                                 IF tab_trigger% OR mx% < ABS(fieldx%(i%)) OR mx% > ABS(fieldx%(i%)) + 6 OR my% <> fieldy%(i%) THEN
  416.  
  417.                                     GOSUB neutralize_field
  418.  
  419.                                 END IF
  420.                             END IF
  421.  
  422.                             IF tab_trigger% = i% OR tab_trigger% = 0 AND fieldx%(i%) > 0 AND mx% >= fieldx%(i%) AND mx% <= fieldx%(i%) + field_size%(i%) + 1 AND my% = fieldy%(i%) THEN
  423.  
  424.                                 GOSUB activate_field
  425.  
  426.                             END IF
  427.                         NEXT
  428.                         EXIT DO
  429.                     LOOP
  430.                 END IF
  431.  
  432.                 IF autoclick% THEN IF oldmx% <> mx% OR oldmy% <> my% THEN autoclick% = 0
  433.                 IF tab_trigger% THEN tab_trigger% = 0
  434.         END SELECT
  435.         oldmx% = mx%: oldmy% = my%
  436.     LOOP
  437.  
  438.     EXIT SUB
  439.  
  440.     starting_values:
  441.     gen_var.w1 = 4: gen_var.w2 = 11
  442.     entry$(1) = "1.00"
  443.     entry$(2) = "1.00"
  444.     entry$(3) = "1.25"
  445.     entry$(4) = "1.25"
  446.     entry$(5) = "12"
  447.     entry$(6) = "Black"
  448.     entry$(7) = "Calibri"
  449.     entry$(8) = "off"
  450.  
  451.     FOR i% = 1 TO 6
  452.         COLOR 3, 1: LOCATE gen_var.w1 + 3, gen_var.w2 + 7 - LEN(field_name$(i%)) / 2: PRINT field_name$(i%);
  453.         COLOR 11, 1
  454.         LOCATE gen_var.w1 + 4, gen_var.w2 + 3
  455.         PRINT CHR$(218); STRING$(6, CHR$(196)); CHR$(191);
  456.         LOCATE gen_var.w1 + 5, gen_var.w2 + 3: PRINT CHR$(179);
  457.         LOCATE gen_var.w1 + 5, gen_var.w2 + 10: PRINT CHR$(179)
  458.         LOCATE gen_var.w1 + 6, gen_var.w2 + 3: PRINT CHR$(192); STRING$(field_size%(i%) + 1, CHR$(196)); CHR$(217);
  459.         COLOR 11, 1: LOCATE gen_var.w1 + 4, gen_var.w2 + 10
  460.         up_arrowy%(i%) = CSRLIN: up_arrowx%(i%) = POS(0)
  461.         IF i% <> 6 THEN
  462.             PRINT CHR$(30);
  463.             COLOR 3, 1: LOCATE gen_var.w1 + 5, gen_var.w2 + 10: PRINT CHR$(186);
  464.         END IF
  465.         COLOR 11, 1: LOCATE gen_var.w1 + 6, gen_var.w2 + 10
  466.         dn_arrowy%(i%) = CSRLIN: dn_arrowx%(i%) = POS(0)
  467.         PRINT CHR$(31);
  468.         COLOR 7, 0: LOCATE gen_var.w1 + 5, gen_var.w2 + 4
  469.         fieldy%(i%) = CSRLIN: fieldx%(i%) = POS(0)
  470.         PRINT SPACE$(field_size%(i%));
  471.         LOCATE gen_var.w1 + 5, gen_var.w2 + 4 + field_size%(i%) - LEN(entry$(i%))
  472.         PRINT entry$(i%);
  473.         COLOR 1, 0: PRINT CHR$(222);
  474.         gen_var.w2 = gen_var.w2 + 15
  475.         IF i% = 4 THEN gen_var.w1 = 10: gen_var.w2 = 11
  476.     NEXT
  477.  
  478.     '---------------------------------------------------------------
  479.  
  480.     i% = 7
  481.     COLOR 3, 1: LOCATE gen_var.w1 + 3, gen_var.w2 + 10: PRINT field_name$(i%);
  482.     COLOR 11, 1: LOCATE gen_var.w1 + 4, gen_var.w2 + 3
  483.     PRINT CHR$(218); STRING$(21, CHR$(196));
  484.     up_arrowy%(i%) = CSRLIN: up_arrowx%(i%) = POS(0) ' Hidden untl popup opens.
  485.     PRINT CHR$(191);
  486.     LOCATE gen_var.w1 + 5, gen_var.w2 + 3: PRINT CHR$(179);
  487.     LOCATE gen_var.w1 + 5, gen_var.w2 + 25: PRINT CHR$(179)
  488.     LOCATE gen_var.w1 + 6, gen_var.w2 + 3: PRINT CHR$(192); STRING$(field_size%(i%) + 1, CHR$(196)); CHR$(217);
  489.     COLOR 11, 1: LOCATE gen_var.w1 + 6, gen_var.w2 + 25
  490.     dn_arrowy%(i%) = CSRLIN: dn_arrowx%(i%) = POS(0)
  491.     PRINT CHR$(31);
  492.     COLOR 7, 0: LOCATE gen_var.w1 + 5, gen_var.w2 + 4
  493.     fieldx%(i%) = POS(0): fieldy%(i%) = CSRLIN
  494.     PRINT SPACE$(field_size%(i%));
  495.     COLOR 1, 0: PRINT CHR$(222);
  496.     LOCATE gen_var.w1 + 5, gen_var.w2 + 4
  497.     COLOR 7, 0
  498.     PRINT entry$(i%);
  499.  
  500.     i% = 8
  501.     gen_var.w1 = 18: gen_var.w2 = 17
  502.     COLOR 11, 1
  503.     LOCATE gen_var.w1, gen_var.w2: PRINT CHR$(218); STRING$(1, CHR$(196)); CHR$(191);
  504.     LOCATE gen_var.w1 + 1, gen_var.w2: PRINT CHR$(179);
  505.     LOCATE gen_var.w1 + 1, gen_var.w2 + 2: PRINT CHR$(179);
  506.     LOCATE gen_var.w1 + 2, gen_var.w2: PRINT CHR$(192); STRING$(field_size%(i%), CHR$(196)); CHR$(217);
  507.     COLOR 7, 0
  508.     LOCATE gen_var.w1 + 1, gen_var.w2 + 1
  509.     fieldx%(i%) = POS(0): fieldy%(i%) = CSRLIN
  510.     PRINT SPACE$(field_size%(i%));
  511.     COLOR 3, 1
  512.     LOCATE gen_var.w1 + 1, gen_var.w2 + 4
  513.     printpagey% = CSRLIN: printpagex% = POS(0)
  514.     PRINT field_name$(i%);
  515.     RETURN
  516.  
  517.     formatbutton:
  518.     Gdown = Button_HW(bw% * 8, bh% * 16, 170, 170, 170, -9, -7, -1, MID$(button_text$, 1, bw% - 2))
  519.     Ghover = Button_HW(bw% * 8, bh% * 16, 200, 200, 200, -8, -7, -1, MID$(button_text$, 1, bw% - 2))
  520.     Gdrag = Button_HW(bw% * 8, bh% * 16, 200, 200, 200, -1, -1, -1, MID$(button_text$, 1, bw% - 2))
  521.     RETURN
  522.  
  523.     formatbutton2:
  524.     Gdown2 = Button_HW(bw% * 8, bh% * 16, 170, 170, 170, -9, -7, -1, MID$(button_text$, 1, bw% - 2))
  525.     Ghover2 = Button_HW(bw% * 8, bh% * 16, 200, 200, 200, -8, -7, -1, MID$(button_text$, 1, bw% - 2))
  526.     Gdrag2 = Button_HW(bw% * 8, bh% * 16, 200, 200, 200, -1, -1, -1, MID$(button_text$, 1, bw% - 2))
  527.     RETURN
  528.  
  529.     bdisplay:
  530.     IF button_display$ <> "off" THEN
  531.         _PUTIMAGE ((bcol% - 1) * 8, (brow% - 1) * 16), Gdown
  532.         _PUTIMAGE ((bcol2% - 1) * 8, (brow2% - 1) * 16), Gdown2
  533.     END IF
  534.     _DISPLAY
  535.     RETURN
  536.  
  537.     bhover:
  538.     IF button_display$ <> "off" THEN
  539.         _PUTIMAGE ((bcol% - 1) * 8, (brow% - 1) * 16), Ghover
  540.         _PUTIMAGE ((bcol2% - 1) * 8, (brow2% - 1) * 16), Gdown2
  541.         tabx% = 9
  542.     END IF
  543.     _DISPLAY
  544.     RETURN
  545.  
  546.     bhover2:
  547.     IF button_display$ <> "off" THEN
  548.         _PUTIMAGE ((bcol% - 1) * 8, (brow% - 1) * 16), Gdown
  549.         _PUTIMAGE ((bcol2% - 1) * 8, (brow2% - 1) * 16), Ghover2
  550.         tabx% = 10
  551.     END IF
  552.     _DISPLAY
  553.     RETURN
  554.  
  555.     activate_field:
  556.     iyy% = CSRLIN: ixx% = POS(0)
  557.     IF i% = 8 THEN j% = 0 ELSE j% = 1
  558.     LOCATE fieldy%(i%) - 1, ABS(fieldx%(i%)) - 1
  559.     COLOR 14, 1
  560.     PRINT CHR$(218); STRING$(field_size%(i%) + j%, 196);
  561.     LOCATE fieldy%(i%), ABS(fieldx%(i%)) - 1
  562.     PRINT CHR$(179);
  563.     IF i% < 6 THEN
  564.         LOCATE fieldy%(i%), ABS(fieldx%(i%)) + field_size%(i%) + 1
  565.         PRINT CHR$(186);
  566.     END IF
  567.     LOCATE fieldy%(i%) + 1, ABS(fieldx%(i%)) - 1
  568.     PRINT CHR$(192); STRING$(field_size%(i%) + j%, 196);
  569.  
  570.     IF i% = 6 OR i% = 7 THEN
  571.         COLOR 14, 1
  572.         LOCATE fieldy%(i%) - 1, ABS(fieldx%(i%)) + field_size%(i%) + 1
  573.         PRINT CHR$(191);
  574.         LOCATE fieldy%(i%), ABS(fieldx%(i%)) + field_size%(i%) + 1
  575.         PRINT CHR$(179);
  576.     END IF
  577.  
  578.     IF i% = 8 THEN
  579.         LOCATE fieldy%(i%) - 1, ABS(fieldx%(i%)) + field_size%(i%)
  580.         PRINT CHR$(191);
  581.         LOCATE fieldy%(i%), ABS(fieldx%(i%)) + field_size%(i%)
  582.         PRINT CHR$(179);
  583.         LOCATE fieldy%(i%) + 1, ABS(fieldx%(i%)) + field_size%(i%)
  584.         PRINT CHR$(217);
  585.     END IF
  586.  
  587.     COLOR 7, 0
  588.     LOCATE iyy%, ixx%
  589.     fieldx%(i%) = -fieldx%(i%)
  590.     tabx% = i%
  591.     RETURN
  592.  
  593.     neutralize_field:
  594.     iyy% = CSRLIN: ixx% = POS(0)
  595.     IF i% = 8 THEN j% = 0 ELSE j% = 1
  596.     fieldx%(i%) = ABS(fieldx%(i%))
  597.     COLOR 11, 1
  598.     LOCATE fieldy%(i%) - 1, fieldx%(i%) - 1
  599.     PRINT CHR$(218); STRING$(field_size%(i%) + j%, 196);
  600.     LOCATE fieldy%(i%), fieldx%(i%) - 1
  601.     PRINT CHR$(179);
  602.     IF i% < 6 THEN
  603.         LOCATE fieldy%(i%), ABS(fieldx%(i%)) + field_size%(i%) + 1
  604.         PRINT CHR$(186);
  605.     END IF
  606.     LOCATE fieldy%(i%) + 1, fieldx%(i%) - 1
  607.     PRINT CHR$(192); STRING$(field_size%(i%) + j%, 196);
  608.  
  609.     IF i% = 6 OR i% = 7 THEN
  610.         COLOR 11, 1
  611.         LOCATE fieldy%(i%) - 1, ABS(fieldx%(i%)) + field_size%(i%) + 1
  612.         PRINT CHR$(191);
  613.         LOCATE fieldy%(i%), ABS(fieldx%(i%)) + field_size%(i%) + 1
  614.         PRINT CHR$(179);
  615.     END IF
  616.  
  617.     IF i% = 8 THEN
  618.         LOCATE fieldy%(i%) - 1, fieldx%(i%) + field_size%(i%)
  619.         PRINT CHR$(191);
  620.         LOCATE fieldy%(i%), fieldx%(i%) + field_size%(i%)
  621.         PRINT CHR$(179);
  622.         LOCATE fieldy%(i%) + 1, fieldx%(i%) + field_size%(i%)
  623.         PRINT CHR$(217);
  624.     END IF
  625.  
  626.     COLOR 7, 0
  627.     LOCATE iyy%, ixx%
  628.     IF tab_trigger% = 0 THEN tabx% = 0
  629.     RETURN
  630.  
  631.     up_arrow:
  632.     iyy% = CSRLIN: ixx% = POS(0)
  633.     LOCATE up_arrowy%(i%), ABS(up_arrowx%(i%))
  634.     COLOR 11, 1
  635.     PRINT CHR$(30);
  636.     GOSUB bdisplay
  637.     _DELAY .1
  638.     LOCATE up_arrowy%(i%), ABS(up_arrowx%(i%))
  639.     COLOR 14, 1
  640.     PRINT CHR$(30);
  641.  
  642.     GOSUB increase_value
  643.  
  644.     LOCATE iyy%, ixx%
  645.     GOSUB bdisplay
  646.     RETURN
  647.  
  648.     dn_arrow:
  649.     iyy% = CSRLIN: ixx% = POS(0)
  650.     LOCATE dn_arrowy%(i%), ABS(dn_arrowx%(i%))
  651.     COLOR 11, 1
  652.     PRINT CHR$(31);
  653.     GOSUB bdisplay
  654.     _DELAY .1
  655.     LOCATE dn_arrowy%(i%), ABS(dn_arrowx%(i%))
  656.     COLOR 14, 1
  657.     PRINT CHR$(31);
  658.  
  659.     GOSUB decrease_value
  660.  
  661.     LOCATE iyy%, ixx%
  662.     GOSUB bdisplay
  663.     RETURN
  664.  
  665.     increase_value: ' Nested GOSUB for up_arrow and dn_arrow------------------
  666.     IF VAL(entry$(i%)) < max_val_entry%(i%) THEN
  667.         IF i% = 5 THEN
  668.             a1$ = entry$(i%)
  669.             j = VAL(a1$)
  670.             j = j + 1
  671.             entry$(i%) = LTRIM$(STR$(j))
  672.         ELSE
  673.             k% = 5: IF mb.w THEN k% = 20
  674.             a1$ = MID$(entry$(i%), 1, INSTR(entry$(i%), ".") - 1) + MID$(entry$(i%), INSTR(entry$(i%), ".") + 1)
  675.             j = VAL(a1$)
  676.             j = j + k%
  677.             a1$ = LTRIM$(STR$(j))
  678.             entry$(i%) = MID$(a1$, 1, LEN(a1$) - 2) + "." + MID$(a1$, 2)
  679.         END IF
  680.         COLOR 7, 0
  681.         LOCATE fieldy%(i%), ABS(fieldx%(i%)): PRINT SPACE$(field_size%(i%));
  682.         LOCATE fieldy%(i%), ABS(fieldx%(i%)) + field_size%(i%) - LEN(entry$(i%))
  683.         PRINT entry$(i%);
  684.     ELSE
  685.         SOUND 500, .1
  686.     END IF
  687.     RETURN
  688.  
  689.     decrease_value:
  690.     IF VAL(entry$(i%)) > min_val_entry%(i%) THEN
  691.         IF i% = 5 THEN
  692.             a1$ = entry$(i%)
  693.             j = VAL(a1$)
  694.             j = j - 1
  695.             entry$(i%) = LTRIM$(STR$(j))
  696.         ELSE
  697.             k% = 5: IF mb.w THEN k% = 20
  698.             a1$ = MID$(entry$(i%), 1, INSTR(entry$(i%), ".") - 1) + MID$(entry$(i%), INSTR(entry$(i%), ".") + 1)
  699.             j = VAL(a1$)
  700.             j = j - k%
  701.             a1$ = LTRIM$(STR$(j))
  702.             entry$(i%) = MID$(a1$, 1, LEN(a1$) - 2) + "." + MID$(a1$, 2)
  703.         END IF
  704.         COLOR 7, 0
  705.         LOCATE fieldy%(i%), ABS(fieldx%(i%)): PRINT SPACE$(field_size%(i%));
  706.         LOCATE fieldy%(i%), ABS(fieldx%(i%)) + field_size%(i%) - LEN(entry$(i%))
  707.         PRINT entry$(i%);
  708.     ELSE
  709.         SOUND 500, .1
  710.     END IF
  711.     RETURN ' End Nested GOSUB-------------------------------------------------
  712.  
  713.     font_color_open_dropdown:
  714.     up_arrowx%(tabx%) = -ABS(up_arrowx%(tabx%))
  715.     smode% = 2
  716.     PCOPY 1, 2
  717.     SCREEN 0, 0, 2, 2
  718.     PALETTE 7, 63
  719.     button_display$ = "on"
  720.     GOSUB bdisplay
  721.     scr = 0: row = 1
  722.     i% = tabx%
  723.     COLOR 11, 1
  724.     LOCATE printpagey%, printpagex%: PRINT SPACE$(LEN(field_name$(8)));
  725.     LOCATE fieldy%(i%) - 1, ABS(fieldx%(i%)) + field_size%(i%) + 1: PRINT CHR$(30);
  726.     LOCATE fieldy%(i%) + 1, ABS(fieldx%(i%)) - 1
  727.  
  728.     FOR j% = 1 TO 5
  729.         COLOR 14, 1: PRINT CHR$(179);
  730.         COLOR 7, 0: PRINT SPACE$(field_size%(i%));
  731.         COLOR 1, 0: PRINT CHR$(222);
  732.         COLOR 14, 1: PRINT CHR$(179);
  733.         LOCATE fieldy%(i%) + j%, ABS(fieldx%(i%)) - 1
  734.     NEXT
  735.  
  736.     PRINT CHR$(192); STRING$(field_size%(i%) + 1, 196); CHR$(217);
  737.     COLOR 8, 0
  738.     LOCATE fieldy%(i%), ABS(fieldx%(i%)): PRINT MID$(entry$(tabx%), 1, field_size%(tabx%));
  739.     COLOR 7, 0
  740.  
  741.     LOCATE fieldy%(i%) + 1, ABS(fieldx%(i%))
  742.     RESTORE font_color_data
  743.     j% = 0
  744.     DO
  745.         READ a1$
  746.         IF a1$ = "EOF" THEN EXIT DO
  747.         j% = j% + 1
  748.  
  749.         IF a1$ <> entry$(tabx%) THEN
  750.             REDIM _PRESERVE font_color$(j%)
  751.             font_color$(j%) = a1$
  752.         ELSE
  753.             j% = j% - 1
  754.         END IF
  755.  
  756.     LOOP
  757.  
  758.     LOCATE fieldy%(i%) + 1, ABS(fieldx%(i%))
  759.  
  760.     FOR k% = 1 TO j%
  761.         IF k% = 1 THEN COLOR 1, 3: hlf% = k%: hlfy% = CSRLIN: hlfx% = POS(0) ELSE COLOR 7, 0
  762.         a1$ = SPACE$(field_size%(tabx%))
  763.         MID$(a1$, 1) = font_color$(k%)
  764.         PRINT a1$;
  765.         LOCATE fieldy%(i%) + k% + 1, ABS(fieldx%(i%))
  766.     NEXT
  767.  
  768.     LOCATE fieldy%(i%) + 1, ABS(fieldx%(i%))
  769.  
  770.     gen_var.vartable = 3: CALL setvariables(scrb, c1%, c2%, c1alt%, h1%, h2%, row, ins%, dwidth, dwidth2, menubar%, menuheightmax%)
  771.  
  772.     DO
  773.         _LIMIT 30
  774.  
  775.         IF autokey$ = "" THEN b$ = INKEY$ ELSE b$ = autokey$: autokey$ = ""
  776.  
  777.         IF LEN(b$) THEN
  778.             SELECT CASE b$
  779.                 CASE CHR$(27)
  780.                     GOSUB close_dropdown
  781.                     EXIT DO
  782.                 CASE CHR$(13)
  783.                     GOSUB close_dropdown
  784.                     entry$(tabx%) = font_color$(row)
  785.                     a1$ = SPACE$(field_size%(tabx%))
  786.                     MID$(a1$, 1) = font_color$(row)
  787.                     LOCATE fieldy%(tabx%), ABS(fieldx%(tabx%))
  788.                     COLOR 7, 0
  789.                     PRINT a1$;
  790.                     EXIT DO
  791.  
  792.                 CASE CHR$(0) + "H"
  793.                     IF row > 1 THEN
  794.                         row = row - 1
  795.                         GOSUB highlight_color
  796.                     END IF
  797.                 CASE CHR$(0) + "P"
  798.                     IF row < page.h THEN
  799.                         row = row + 1
  800.                         GOSUB highlight_color
  801.                     END IF
  802.                 CASE CHR$(0) + "w"
  803.                     scr = 0:: row = 1
  804.                 CASE CHR$(0) + "u"
  805.                     scr = noe - page.h: row = page.h
  806.             END SELECT
  807.  
  808.         ELSE
  809.  
  810.             GOSUB poll_mouse
  811.  
  812.         END IF
  813.  
  814.         IF my% = yclose% AND mx% = ABS(xclose%) THEN
  815.             IF mb.l AND l_click% = 0 OR mb.l AND autoclick% THEN GOSUB close_x
  816.         END IF
  817.  
  818.         GOSUB audit_close_x
  819.  
  820.         IF mb.l THEN
  821.             IF my% = up_arrowy%(tabx%) AND mx% = ABS(up_arrowx%(tabx%)) THEN
  822.                 GOSUB close_dropdown
  823.                 EXIT DO
  824.             END IF
  825.  
  826.             IF my% >= fieldy%(tabx%) AND my% <= fieldy%(tabx%) + 5 THEN
  827.                 IF mx% >= ABS(fieldx%(tabx%)) AND mx% <= ABS(fieldx%(tabx%)) + field_size%(tabx%) - 1 THEN
  828.                     GOSUB close_dropdown
  829.                     IF my% <> fieldy%(tabx%) THEN
  830.                         entry$(tabx%) = font_color$(row)
  831.                         a1$ = SPACE$(field_size%(tabx%))
  832.                         MID$(a1$, 1) = font_color$(row)
  833.                         LOCATE fieldy%(tabx%), ABS(fieldx%(tabx%))
  834.                         COLOR 7, 0
  835.                         PRINT a1$;
  836.                     END IF
  837.                     EXIT DO
  838.                 END IF
  839.             END IF
  840.  
  841.         ELSEIF mb.w THEN
  842.             IF mb.w < 0 THEN autokey$ = CHR$(0) + "H"
  843.             IF mb.w > 0 THEN autokey$ = CHR$(0) + "P"
  844.             mb.w = 0
  845.             _DELAY .2
  846.  
  847.         ELSE
  848.             IF oldmx% <> mx% OR oldmy% <> my% THEN
  849.                 IF mx% >= ABS(fieldx%(tabx%)) AND mx% <= ABS(fieldx%(tabx%)) + field_size%(tabx%) - 1 THEN
  850.                     IF my% > fieldy%(tabx%) AND my% <= fieldy%(tabx%) + 4 THEN
  851.                         row = my% - fieldy%(tabx%)
  852.                         GOSUB highlight_color
  853.                     END IF
  854.                 END IF
  855.             END IF
  856.         END IF
  857.  
  858.         IF my% = up_arrowy%(tabx%) AND mx% = ABS(up_arrowx%(tabx%)) THEN
  859.             hover_arrow% = tabx%
  860.             iyy% = CSRLIN: ixx% = POS(0)
  861.             COLOR 14, 1: LOCATE up_arrowy%(tabx%), ABS(up_arrowx%(tabx%))
  862.             PRINT CHR$(30);
  863.             LOCATE iyy%, ixx%
  864.         ELSE
  865.             IF hover_arrow% THEN
  866.                 iyy% = CSRLIN: ixx% = POS(0)
  867.                 COLOR 11, 1: LOCATE up_arrowy%(tabx%), ABS(up_arrowx%(tabx%))
  868.                 PRINT CHR$(30);
  869.                 LOCATE iyy%, ixx%
  870.             END IF
  871.         END IF
  872.  
  873.         GOSUB bdisplay
  874.  
  875.         oldmx% = mx%: oldmy% = my%
  876.     LOOP
  877.  
  878.     COLOR 7, 0
  879.     RETURN
  880.  
  881.     ' NESTED GOSUBS for font_color_open_dropdown -----------------------------
  882.  
  883.     highlight_color:
  884.     IF hlf% THEN
  885.         LOCATE hlfy%, hlfx%
  886.         COLOR 7, 0
  887.         a1$ = SPACE$(field_size%(tabx%))
  888.         MID$(a1$, 1) = font_color$(hlf%)
  889.         PRINT a1$;
  890.     END IF
  891.  
  892.     LOCATE fieldy%(tabx%) + row, ABS(fieldx%(tabx%))
  893.     a1$ = SPACE$(field_size%(tabx%))
  894.     MID$(a1$, 1) = font_color$(row)
  895.     hlf% = row: hlfy% = CSRLIN: hlfx% = POS(0)
  896.     COLOR 1, 3: PRINT a1$;: COLOR 7, 0
  897.     LOCATE fieldy%(tabx%) + row, ABS(fieldx%(tabx%))
  898.     RETURN ' END NESTED GOSUBS --------------------------------------------------------
  899.  
  900.     font_type_open_dropdown:
  901.     up_arrowx%(tabx%) = -ABS(up_arrowx%(tabx%))
  902.  
  903.     gen_var.vartable = 4: CALL setvariables(scrb, c1%, c2%, c1alt%, h1%, h2%, row, ins%, dwidth, dwidth2, menubar%, menuheightmax%)
  904.  
  905.     smode% = 2
  906.     PCOPY 1, 2
  907.     SCREEN 0, 0, 2, 2
  908.     PALETTE 7, 63
  909.     i% = tabx%
  910.     COLOR 8, 0
  911.     LOCATE fieldy%(i%), ABS(fieldx%(i%)): PRINT MID$(entry$(tabx%), 1, field_size%(tabx%));
  912.     COLOR 11, 1
  913.     LOCATE fieldy%(i%) - 1, ABS(fieldx%(i%)) + field_size%(i%) + 1: PRINT CHR$(30);
  914.     LOCATE fieldy%(i%) + 1, ABS(fieldx%(i%)) - 1
  915.     FOR j% = 1 TO 5
  916.         COLOR 14, 1: PRINT CHR$(179);
  917.         COLOR 7, 0: PRINT SPACE$(field_size%(i%));
  918.         COLOR 1, 0: PRINT CHR$(222);
  919.         COLOR 14, 1: PRINT CHR$(179);
  920.         LOCATE fieldy%(i%) + j%, ABS(fieldx%(i%)) - 1
  921.     NEXT
  922.     PRINT CHR$(192); STRING$(field_size%(i%) + 1, 196); CHR$(217);
  923.     COLOR 7, 0
  924.     button_display$ = "off"
  925.  
  926.     COLOR 11, 1
  927.     LOCATE fieldy%(i%) - 1, ABS(fieldx%(i%)) + field_size%(i%) + 1: PRINT CHR$(30);
  928.     LOCATE fieldy%(i%) + 1, ABS(fieldx%(i%)) - 1
  929.     FOR j% = 1 TO 7
  930.         COLOR 14, 1: PRINT CHR$(179);
  931.         COLOR 7, 0: PRINT SPACE$(field_size%(i%));
  932.         COLOR 1, 0: PRINT CHR$(222);
  933.         COLOR 14, 1: PRINT CHR$(179);
  934.         LOCATE fieldy%(i%) + j%, ABS(fieldx%(i%)) - 1
  935.     NEXT
  936.     PRINT CHR$(192); STRING$(field_size%(i%) + 1, 196); CHR$(217);
  937.     COLOR 7, 0
  938.  
  939.     IF noe = 0 THEN
  940.         j% = 0
  941.         RESTORE font_types
  942.         DO
  943.             READ a1$
  944.             IF a1$ = "EOF" THEN EXIT DO
  945.             j% = j% + 1
  946.             REDIM _PRESERVE font_type$(j%)
  947.             font_type$(j%) = a1$
  948.         LOOP
  949.         noe = UBOUND(font_type$)
  950.     END IF
  951.  
  952.     h% = 999: CALL scrollbar_update(h%, scrb, noe, row, scr)
  953.     h% = 1: CALL scrollbar_update(h%, scrb, noe, row, scr)
  954.  
  955.     i% = tabx%
  956.     LOCATE fieldy%(i%) + 1, ABS(fieldx%(i%))
  957.     j% = 0
  958.     DO
  959.         j% = j% + 1
  960.         PRINT font_type$(j%);
  961.         IF j% = 6 THEN EXIT DO
  962.         LOCATE fieldy%(i%) + 1 + j%, ABS(fieldx%(i%))
  963.     LOOP
  964.  
  965.     LOCATE fieldy%(i%) + 1, ABS(fieldx%(i%))
  966.     row = 1: scr = 0
  967.  
  968.     GOSUB highlight_font
  969.  
  970.     DO
  971.         _LIMIT 30
  972.  
  973.         IF autokey$ = "" THEN b$ = INKEY$ ELSE b$ = autokey$: autokey$ = ""
  974.  
  975.         IF LEN(b$) THEN
  976.             SELECT CASE b$
  977.                 CASE CHR$(27)
  978.                     GOSUB close_dropdown: EXIT DO
  979.                 CASE CHR$(13)
  980.                     GOSUB close_dropdown
  981.                     entry$(tabx%) = font_type$(scr + row)
  982.                     a1$ = SPACE$(field_size%(tabx%))
  983.                     MID$(a1$, 1) = font_type$(scr + row)
  984.                     LOCATE fieldy%(tabx%), ABS(fieldx%(tabx%))
  985.                     COLOR 7, 0
  986.                     PRINT a1$;
  987.                     EXIT DO
  988.                 CASE "a" TO "z", "A" TO "Z"
  989.                     IF noe > 0 THEN
  990.                         DO
  991.                             b$ = UCASE$(b$)
  992.  
  993.                             IF b$ = oldb$ AND scr + 2 <= noe THEN ' Step through same first letter files.
  994.                                 IF UCASE$(LEFT$(font_type$(scr + 2), 1)) = b$ AND scr + page.h < noe THEN
  995.                                     scr = scr + 1
  996.                                     row = 1: GOSUB scrollfonts
  997.                                 END IF
  998.                                 EXIT DO
  999.                             ELSE
  1000.                                 oldb$ = b$
  1001.                             END IF
  1002.  
  1003.                             i% = 0
  1004.                             DO
  1005.                                 IF i% = noe THEN EXIT DO
  1006.                                 i% = i% + 1
  1007.                                 x$ = UCASE$(MID$(font_type$(i%), 1, 1))
  1008.                                 IF b$ <= x$ AND x$ >= "A" AND x$ <= "Z" THEN EXIT DO
  1009.                                 IF x$ <> oldx$ THEN oldx$ = x$: j% = i%
  1010.                             LOOP
  1011.  
  1012.                             IF b$ = x$ THEN
  1013.                                 scr = i% - 1
  1014.                                 IF scr + page.h > noe THEN scr = noe - page.h
  1015.                                 row = 1: GOSUB scrollfonts
  1016.                             ELSEIF b$ < x$ THEN
  1017.                                 oldb$ = "" ' No exact match so disable step option.
  1018.                                 scr = j% - 1
  1019.                                 IF scr + page.h > noe THEN scr = noe - page.h
  1020.                                 row = 1: GOSUB scrollfonts
  1021.                             END IF
  1022.                             EXIT DO
  1023.                         LOOP
  1024.                     END IF
  1025.                 CASE CHR$(0) + "H"
  1026.                     IF row > 1 THEN
  1027.                         row = row - 1
  1028.                         GOSUB highlight_font
  1029.                     ELSE
  1030.                         scr = scr - 1
  1031.                         GOSUB scrollfonts
  1032.                     END IF
  1033.                 CASE CHR$(0) + "P"
  1034.                     IF row < page.h THEN
  1035.                         row = row + 1
  1036.                         GOSUB highlight_font
  1037.                     ELSE
  1038.                         IF scr < noe - page.h THEN
  1039.                             scr = scr + 1
  1040.                             GOSUB scrollfonts
  1041.                         END IF
  1042.                     END IF
  1043.                 CASE CHR$(0) + "I"
  1044.                     k% = page.h - 1
  1045.                     IF scr - k% >= 0 THEN scr = scr - k% ELSE scr = 0
  1046.                     GOSUB scrollfonts
  1047.                 CASE CHR$(0) + "Q"
  1048.                     k% = page.h - 1
  1049.                     IF scr + k% <= noe - page.h THEN scr = scr + k% ELSE scr = noe - page.h
  1050.                     GOSUB scrollfonts
  1051.                 CASE CHR$(0) + "w"
  1052.                     scr = 0:: row = 1
  1053.                     GOSUB scrollfonts
  1054.                 CASE CHR$(0) + "u"
  1055.                     scr = noe - page.h: row = page.h
  1056.                     GOSUB scrollfonts
  1057.             END SELECT
  1058.  
  1059.         ELSE
  1060.  
  1061.             GOSUB poll_mouse
  1062.  
  1063.         END IF
  1064.  
  1065.         IF mb.l AND l_click% = 0 THEN
  1066.             IF my% >= fieldy%(tabx%) AND my% <= fieldy%(tabx%) + 6 THEN
  1067.                 IF mx% >= ABS(fieldx%(tabx%)) AND mx% <= ABS(fieldx%(tabx%)) + field_size%(tabx%) - 1 THEN
  1068.                     GOSUB close_dropdown
  1069.                     IF my% <> fieldy%(tabx%) THEN
  1070.                         entry$(tabx%) = font_type$(scr + row)
  1071.                         a1$ = SPACE$(field_size%(tabx%))
  1072.                         MID$(a1$, 1) = font_type$(scr + row)
  1073.                         LOCATE fieldy%(tabx%), ABS(fieldx%(tabx%))
  1074.                         COLOR 7, 0
  1075.                         PRINT a1$;
  1076.                     END IF
  1077.                     EXIT DO
  1078.                 END IF
  1079.             END IF
  1080.         END IF
  1081.  
  1082.         IF my% = yclose% AND mx% = ABS(xclose%) THEN
  1083.             IF mb.l AND l_click% = 0 OR mb.l AND autoclick% THEN GOSUB close_x
  1084.         END IF
  1085.  
  1086.         GOSUB audit_close_x
  1087.  
  1088.         ' Scrollbar routine.
  1089.         IF mb.l THEN
  1090.             IF my% = up_arrowy%(tabx%) AND mx% = ABS(up_arrowx%(tabx%)) THEN
  1091.                 GOSUB close_dropdown
  1092.                 EXIT DO
  1093.             END IF
  1094.  
  1095.             IF mx% >= scrb.l - 1 AND mx% <= scrb.l + 1 AND my% - (scrb.t + 1) >= scrb.x AND my% - (scrb.t + 1) <= scrb.x + scrb.s - 1 THEN draglock% = -1
  1096.  
  1097.             IF draglock% = -1 AND my% > scrb.t AND my% < scrb.b OR mx% = scrb.l AND scrb.s <> 0 AND my% >= scrb.t AND my% <= scrb.b AND mb.w = 0 OR scrbardrag% AND my% > scrb.t AND my% < scrb.b AND mb.w = 0 THEN ' Mouse on scrollbar, doing a bar cursor drag.
  1098.                 gen_var.locked = 2 ' Locked on scrollbar
  1099.  
  1100.                 IF my% = scrb.t AND scrb.x = 0 OR my% = scrb.b AND scrb.x + scrb.s = scrb.h THEN ' Mouse on a scrollbar arrow.
  1101.                     IF my% = scrb.t THEN scrb.i = 0 ELSE scrb.i = noe - page.h
  1102.                     scr = scrb.i
  1103.  
  1104.                     h% = 0: CALL scrollbar_update(h%, scrb, noe, row, scr) ' Positions scrollbar box.
  1105.  
  1106.                     GOSUB scrollfonts
  1107.  
  1108.                 ELSEIF my% = scrb.t AND scrb.x > 0 OR my% = scrb.b AND scrb.x + scrb.s <= scrb.h THEN ' Mouse on a scrollbar arrow.
  1109.                     IF my% = scrb.t AND mb.w = 0 THEN
  1110.                         IF scrb.x > 0 THEN scrb.x = scrb.x - 1: h% = -1 ' Top arrow
  1111.                     ELSE
  1112.                         scrb.x = scrb.x + 1: h% = -2 ' Bottom arrow.
  1113.                     END IF
  1114.                     IF mb.w = 0 THEN delay.on! = .15
  1115.  
  1116.                     j% = INT(scrb.x * ((noe - scrb.d) / (scrb.h - scrb.s)))
  1117.  
  1118.                     IF j% >= 0 AND j% <= noe - page.h THEN ' Condition exists unless j% is negative such as doc is blank and mouse wheel is rolled downward.
  1119.                         scrb.i = j%
  1120.  
  1121.                         scr = scrb.i
  1122.  
  1123.                         h% = 0: CALL scrollbar_update(h%, scrb, noe, row, scr) ' Positions scrollbar box.
  1124.  
  1125.                         GOSUB scrollfonts
  1126.                     END IF
  1127.  
  1128.                 ELSEIF my% - (scrb.t + 1) >= scrb.x AND my% - (scrb.t + 1) <= scrb.x + scrb.s - 1 AND scrbardrag% = 0 THEN ' Mouse on scrollbar block.
  1129.                     scrbardrag% = -1: scrb.adjust = (my% - (scrb.t + 1)) - scrb.x
  1130.                 ELSEIF draglock% = -1 AND my% > scrb.t AND my% < scrb.b OR my% > scrb.t AND my% < scrb.b THEN ' Mouse on scrollbar between scrollbar arrow and cursor.
  1131.                     IF draglock% = -1 AND my% > scrb.t AND my% < scrb.b OR my% - (scrb.t + 1) - scrb.adjust >= 0 AND my% - (scrb.t + 1) + scrb.s - scrb.adjust <= scrb.h AND scrbardrag% <> -1 OR scrbardrag% = 0 THEN
  1132.                         IF scrbardrag% = 0 THEN ' No drag, so adjust for cursor length for a click inside the scrollbar above or below the current scrollbar cursor position.
  1133.                             IF my% - (scrb.t + 1) > scrb.x THEN
  1134.                                 scrb.adjust = (my% - (scrb.t + 1)) - scrb.x - 1: h% = -1
  1135.                             ELSE
  1136.                                 scrb.adjust = (my% - (scrb.t + 1)) - scrb.x + 1: h% = -2
  1137.                             END IF
  1138.                         END IF
  1139.                         scrb.x = my% - (scrb.t + 1) - scrb.adjust
  1140.                         scrb.i = INT(scrb.x * ((noe - scrb.d) / (scrb.h - scrb.s)))
  1141.  
  1142.                         scr = scrb.i
  1143.  
  1144.                         h% = 0: CALL scrollbar_update(h%, scrb, noe, row, scr)
  1145.  
  1146.                         GOSUB scrollfonts
  1147.  
  1148.                         IF delay.on! THEN ' Scrollbar delay.
  1149.                             _DELAY delay.on!
  1150.                             delay.on! = 0 ' Toggle off.
  1151.                         END IF
  1152.  
  1153.                     ELSE ' Scrollbar is at top or bottom and mouse cursor is moving vertically along the scrollbar cursor. This allows the variable to readjust.
  1154.                         IF mx% = scrb.l THEN scrbardrag% = 0: scrb.adjust = 0: draglock% = 0
  1155.                     END IF
  1156.                 END IF
  1157.                 ' =======================================================
  1158.  
  1159.             END IF
  1160.             _DELAY .2
  1161.         ELSEIF mb.w THEN
  1162.             IF mb.w > 0 THEN autokey$ = CHR$(0) + "Q"
  1163.             IF mb.w < 0 THEN autokey$ = CHR$(0) + "I"
  1164.             mb.w = 0
  1165.             _DELAY .2
  1166.             scrbardrag% = 0: scrb.adjust = 0: draglock% = 0
  1167.             IF gen_var.locked = 2 AND mb.l = 0 THEN gen_var.locked = 0
  1168.  
  1169.         ELSE
  1170.             scrbardrag% = 0: scrb.adjust = 0: draglock% = 0
  1171.             IF gen_var.locked = 2 AND mb.l = 0 THEN gen_var.locked = 0
  1172.  
  1173.             IF oldmx% <> mx% OR oldmy% <> my% THEN
  1174.                 IF mx% >= ABS(fieldx%(tabx%)) AND mx% <= ABS(fieldx%(tabx%)) + field_size%(tabx%) - 1 THEN
  1175.                     IF my% > fieldy%(tabx%) AND my% <= fieldy%(tabx%) + 6 THEN
  1176.                         row = my% - fieldy%(tabx%)
  1177.                         GOSUB highlight_font
  1178.                     END IF
  1179.                 END IF
  1180.             END IF
  1181.         END IF
  1182.  
  1183.         IF my% = up_arrowy%(tabx%) AND mx% = ABS(up_arrowx%(tabx%)) THEN
  1184.             hover_arrow% = tabx%
  1185.             iyy% = CSRLIN: ixx% = POS(0)
  1186.             COLOR 14, 1: LOCATE up_arrowy%(tabx%), ABS(up_arrowx%(tabx%))
  1187.             PRINT CHR$(30);
  1188.             LOCATE iyy%, ixx%
  1189.         ELSE
  1190.             IF hover_arrow% THEN
  1191.                 iyy% = CSRLIN: ixx% = POS(0)
  1192.                 COLOR 11, 1: LOCATE up_arrowy%(tabx%), ABS(up_arrowx%(tabx%))
  1193.                 PRINT CHR$(30);
  1194.                 LOCATE iyy%, ixx%
  1195.             END IF
  1196.         END IF
  1197.  
  1198.         oldmx% = mx%: oldmy% = my%
  1199.  
  1200.         GOSUB bdisplay
  1201.     LOOP
  1202.  
  1203.     RETURN
  1204.  
  1205.     ' NESTED GOSUB for font_type_open_dropdown ------------------------------
  1206.     scrollfonts:
  1207.     COLOR 7, 0
  1208.     IF scr < 0 THEN scr = 0 ' Precaution.
  1209.     FOR i% = 1 TO page.h
  1210.         IF i% + scr > noe THEN EXIT FOR
  1211.         LOCATE fieldy%(tabx%) + i%, ABS(fieldx%(tabx%))
  1212.         a1$ = SPACE$(field_size%(tabx%))
  1213.         MID$(a1$, 1) = font_type$(i% + scr)
  1214.         IF i% = row THEN
  1215.             COLOR 1, 3
  1216.             hlf% = row + scr: hlfy% = CSRLIN: hlfx% = POS(0)
  1217.         ELSE
  1218.             COLOR 7, 0
  1219.         END IF
  1220.         PRINT a1$;
  1221.     NEXT
  1222.     LOCATE fieldy%(tabx%) + row, ABS(fieldx%(tabx%))
  1223.  
  1224.     h% = 1: CALL scrollbar_update(h%, scrb, noe, row, scr)
  1225.  
  1226.     RETURN
  1227.  
  1228.     print_page_num:
  1229.     iyy% = CSRLIN: ixx% = POS(0)
  1230.     IF entry$(i%) = "off" THEN entry$(i%) = "on" ELSE entry$(i%) = "off"
  1231.     COLOR 8, 0
  1232.     LOCATE fieldy%(i%), ABS(fieldx%(i%))
  1233.     IF entry$(i%) = "on" THEN PRINT CHR$(254); ELSE PRINT " ";
  1234.     COLOR 7, 0
  1235.     LOCATE iyy%, ixx%
  1236.     RETURN
  1237.  
  1238.     reset_values:
  1239.     GOSUB bdisplay: _DELAY .1
  1240.     SOUND 1000, .1
  1241.     GOSUB bhover
  1242.     GOSUB starting_values
  1243.     RETURN
  1244.  
  1245.     print_doc:
  1246.     REDIM twips%(4)
  1247.     GOSUB bdisplay: _DELAY .1
  1248.     SOUND 1000, .1
  1249.     GOSUB bhover
  1250.     _DELAY .5
  1251.     CLS
  1252.     margin_rtf$ = "\viewkind4\uc1\pard\"
  1253.     REDIM twips%(4)
  1254.     FOR i% = 1 TO nof%
  1255.         SELECT CASE i%
  1256.             CASE 1, 2
  1257.                 IF VAL(entry$(i%)) > 1.25 THEN
  1258.                     twips%(i%) = VAL(entry$(i%)) * 1440 - 1800
  1259.                     IF i% = 1 THEN
  1260.                         margin_rtf$ = margin_rtf$ + "margt" + LTRIM$(STR$(twips%(i%))) + "\"
  1261.                     ELSE
  1262.                         margin_rtf$ = margin_rtf$ + "margb" + LTRIM$(STR$(twips%(i%))) + "\"
  1263.                     END IF
  1264.                 END IF
  1265.             CASE 3, 4
  1266.                 IF VAL(entry$(i%)) > 1.00 THEN
  1267.                     twips%(i%) = VAL(entry$(i%)) * 1440 - 1440
  1268.                     IF i% = 3 THEN
  1269.                         margin_rtf$ = margin_rtf$ + "li" + LTRIM$(STR$(twips%(i%))) + "\"
  1270.                     ELSE
  1271.                         margin_rtf$ = margin_rtf$ + "ri" + LTRIM$(STR$(twips%(i%))) + "\"
  1272.                     END IF
  1273.                 END IF
  1274.             CASE 5
  1275.                 fontsize% = VAL(entry$(i%)) * 2
  1276.                 fontsize_rtf$ = "sa200\sl276\slmult1\cf1\fs" + LTRIM$(STR$(fontsize%)) + "\lang9 "
  1277.             CASE 6
  1278.                 SELECT CASE LCASE$(entry$(i%))
  1279.                     CASE "black"
  1280.                         fontcolor_rtf$ = "{\colortbl ;\red0\green0\blue0;}"
  1281.                     CASE "red"
  1282.                         fontcolor_rtf$ = "{\colortbl ;\red255\green0\blue0;}"
  1283.                     CASE "blue"
  1284.                         fontcolor_rtf$ = "{\colortbl ;\red0\green0\blue255;}"
  1285.                     CASE "green"
  1286.                         fontcolor_rtf$ = "{\colortbl ;\red0\green255\blue0;}"
  1287.                     CASE "grey"
  1288.                         fontcolor_rtf$ = "{\colortbl ;\red102\green102\blue102;}"
  1289.                 END SELECT
  1290.  
  1291.             CASE 7
  1292.                 fonttype_rtf$ = "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 " + entry$(i%) + ";}}"
  1293.             CASE 8
  1294.                 IF entry$(i%) = "on" THEN printpagefooter$ = "{\field{\*\fldinst PAGE}{\fldrslt 1}}" ELSE printpagefooter$ = ""
  1295.         END SELECT
  1296.  
  1297.     NEXT
  1298.  
  1299.     header$ = fonttype_rtf$ + fontcolor_rtf$ + margin_rtf$ + fontsize_rtf$
  1300.     footer$ = "\cf0\f1\fs22\par}" + printpagefooter$
  1301.  
  1302.     CLS
  1303.     PRINT header$
  1304.     PRINT "Your text goes here!"
  1305.     PRINT footer$
  1306.     _CLIPBOARD$ = header$ + "Your text here!" + footer$
  1307.     END ''''''''''''''''''''''''''
  1308.     RETURN
  1309.  
  1310.     highlight_font:
  1311.     IF hlf% THEN
  1312.         LOCATE hlfy%, hlfx%
  1313.         COLOR 7, 0
  1314.         a1$ = SPACE$(field_size%(tabx%))
  1315.         MID$(a1$, 1) = font_type$(hlf%)
  1316.         PRINT a1$;
  1317.     END IF
  1318.  
  1319.     LOCATE fieldy%(tabx%) + row, ABS(fieldx%(tabx%))
  1320.     a1$ = SPACE$(field_size%(tabx%))
  1321.     MID$(a1$, 1) = font_type$(row + scr)
  1322.     hlf% = row + scr: hlfy% = CSRLIN: hlfx% = POS(0)
  1323.     COLOR 1, 3: PRINT a1$;: COLOR 7, 0
  1324.     LOCATE fieldy%(tabx%) + row, ABS(fieldx%(tabx%))
  1325.     RETURN ' END NESTED GOSUBS --------------------------------------------------------
  1326.  
  1327.     poll_mouse:
  1328.     IF mb.l AND l_click% = 0 THEN l_click% = -1
  1329.     mb.w = 0
  1330.         mb.w = mb.w + _MOUSEWHEEL
  1331.     WEND
  1332.  
  1333.     IF mb.w = 0 THEN
  1334.         mx% = _MOUSEX ' Mouse column.
  1335.         my% = _MOUSEY ' Mouse row.
  1336.         mb.l = _MOUSEBUTTON(1)
  1337.         mb.r = _MOUSEBUTTON(2)
  1338.         mb.m = _MOUSEBUTTON(3)
  1339.     END IF
  1340.  
  1341.     IF mb.l = 0 AND l_click% THEN l_click% = 0
  1342.     RETURN
  1343.  
  1344.     close_dropdown:
  1345.     smode% = 1
  1346.     SCREEN 0, 0, 1, 1
  1347.     up_arrowx%(tabx%) = ABS(up_arrowx%(tabx%))
  1348.     IF button_display$ = "off" THEN button_display$ = "on"
  1349.     hlf% = 0: hlfx% = 0: hlfy% = 0
  1350.     COLOR 7, 0
  1351.     RETURN
  1352.  
  1353.     audit_close_x:
  1354.     IF my% = yclose% AND mx% = xclose% THEN
  1355.         iyy% = CSRLIN: ixx% = POS(0)
  1356.         COLOR 15, 4: LOCATE yclose%, xclose%: PRINT "x";
  1357.         xclose% = -xclose%
  1358.         LOCATE iyy%, ixx%
  1359.     END IF
  1360.  
  1361.     IF xclose% < 0 THEN
  1362.         IF my% <> yclose% OR mx% <> ABS(xclose%) THEN
  1363.             xclose% = ABS(xclose%)
  1364.             iyy% = CSRLIN: ixx% = POS(0)
  1365.             COLOR 7, 1: LOCATE yclose%, xclose%: PRINT "x";
  1366.             LOCATE iyy%, ixx%
  1367.             COLOR 7, 0
  1368.         END IF
  1369.     END IF
  1370.     RETURN
  1371.  
  1372.     close_x:
  1373.     SOUND 1000, .1
  1374.     xclose% = ABS(xclose%)
  1375.     COLOR 15, 1
  1376.     LOCATE yclose%, xclose%
  1377.     PRINT "x";
  1378.     GOSUB bdisplay
  1379.     _DELAY .15
  1380.     COLOR 7, 0
  1381.     SYSTEM ''''''''''''
  1382.     RETURN
  1383.  
  1384.  
  1385. SUB font_size_setup (ENL%)
  1386.     IF displayfullscreen% = -1 THEN EXIT SUB
  1387.     WINXX1% = CSRLIN: WINYY1% = POS(1)
  1388.     winmode$ = "2"
  1389.  
  1390.     IF ENL% <> 0 THEN
  1391.         full = _FULLSCREEN
  1392.         IF full = 0 THEN
  1393.             SELECT CASE ENL%
  1394.                 CASE -1: IF SCRNSIZE% > 0 THEN ELSE EXIT SUB
  1395.                 CASE 1: IF SCRNSIZE% < 14 THEN ELSE EXIT SUB
  1396.             END SELECT
  1397.         ELSE
  1398.             EXIT SUB
  1399.         END IF
  1400.     END IF
  1401.  
  1402.     SCRNSIZE% = SCRNSIZE% + ENL%
  1403.  
  1404.     SELECT CASE winmode$
  1405.         CASE "1"
  1406.             full = _FULLSCREEN
  1407.             IF full <> 0 THEN _FULLSCREEN _OFF
  1408.             GOSUB ChangeFont
  1409.         CASE "2"
  1410.             full = _FULLSCREEN
  1411.             IF full <> 0 THEN _FULLSCREEN _OFF
  1412.             style$ = "MONOSPACE"
  1413.             fontsize% = SCRNSIZE% + 13
  1414.             IF fontsize% < 14 THEN winmode$ = ""
  1415.             IF fontsize% < 18 THEN style$ = style$ + ", BOLD"
  1416.             fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\lucon.ttf" 'Find Windows Folder Path.
  1417.             GOSUB ChangeFont
  1418.         CASE "3"
  1419.             GOSUB ChangeFont
  1420.             _FULLSCREEN _SQUAREPIXELS
  1421.             full = _FULLSCREEN
  1422.             IF full = 0 THEN GOSUB nofull
  1423.         CASE "4"
  1424.             GOSUB ChangeFont
  1425.             _FULLSCREEN _STRETCH
  1426.             full = _FULLSCREEN
  1427.             IF full = 0 THEN GOSUB nofull
  1428.     END SELECT
  1429.  
  1430.     LOCATE WINXX1%, WINYY1%
  1431.     EXIT SUB
  1432.  
  1433.     nofull:
  1434.     RETURN
  1435.  
  1436.     ChangeFont:
  1437.     IF winmode$ <> "2" THEN
  1438.         _FONT 16 ' Inbuilt 8x16 default font.
  1439.         currentf& = _FONT
  1440.     ELSE
  1441.         currentf& = _LOADFONT(fontpath$, fontsize%, style$)
  1442.         _FONT currentf&
  1443.     END IF
  1444.  
  1445.     IF currentf& <> f& AND f& <> defaultf& THEN _FREEFONT f&
  1446.     f& = currentf&
  1447.     RETURN
  1448.  
  1449.  
  1450. SUB popup (msg$, msg%, button$(), button%, button_index%, text$, config%, mydelay%, mx%, my%, xclose%, yclose%)
  1451.     DIM scrb AS my_scrb
  1452.  
  1453.     SELECT CASE fndrep.find_or_replace
  1454.         CASE 0 ' Message box only like exit. Find / Replace are cases 1 and 2.
  1455.             REDIM ifield$(0)
  1456.         CASE 1
  1457.             config% = 2 ' Find
  1458.             REDIM ifield$(1)
  1459.             REDIM entry$(1)
  1460.             msg$ = ""
  1461.             fndrep.ifield = 48 ' Input field length.
  1462.             ifield$(1) = "Find:"
  1463.             button% = 4: button_index% = 4
  1464.             gen_var.w1 = 0: gen_var.w2 = 0: gen_var.w3 = 0: gen_var.w4 = 0
  1465.             fndrep.noif = 1
  1466.         CASE 2
  1467.             config% = 3 ' Find / Replace
  1468.             REDIM ifield$(2)
  1469.             REDIM entry$(2)
  1470.             msg$ = ""
  1471.             fndrep.ifield = 48
  1472.             ifield$(1) = "   Find:"
  1473.             ifield$(2) = "Replace:"
  1474.             button% = 4: button_index% = 4
  1475.             gen_var.w1 = 0: gen_var.w2 = 0: gen_var.w3 = 7: gen_var.w4 = 0
  1476.             fndrep.noif = 2
  1477.     END SELECT
  1478.  
  1479.     iyy% = CSRLIN: ixx% = POS(0)
  1480.  
  1481.     SELECT CASE msg%
  1482.         CASE -2
  1483.             IF gen_var.w3 = 0 THEN gen_var.w3 = 3 ' Min.
  1484.         CASE ELSE
  1485.             REDIM button$(8), ifieldyy%(fndrep.noif), ifieldxx%(fndrep.noif)
  1486.             button$(1) = "Yes": button$(2) = "No!"
  1487.             button$(3) = "Retry": button$(4) = "Cancel"
  1488.             button$(5) = "Whole Word": button$(6) = "Whole/Case": button$(7) = "Any Part": button$(8) = "Any/Case"
  1489.             IF gen_var.w3 = 0 THEN gen_var.w3 = 5 ' Min.
  1490.     END SELECT
  1491.  
  1492.     IF gen_var.w4 = 0 THEN ' Calculate form container width
  1493.         IF fndrep.find_or_replace = 0 THEN
  1494.             gen_var.w4 = LEN(msg$) + 4 ' Min
  1495.         ELSE
  1496.             FOR i% = 1 TO UBOUND(ifield$)
  1497.                 IF LEN(ifield$(i%)) + fndrep.ifield > gen_var.w4 THEN gen_var.w4 = LEN(ifield$(i%)) + fndrep.ifield + 6
  1498.             NEXT
  1499.         END IF
  1500.     END IF
  1501.  
  1502.     IF gen_var.w1 = 0 THEN
  1503.         ' Auto-Center
  1504.         gen_var.w1 = _HEIGHT \ 2 - gen_var.w3 \ 2 + .5
  1505.         gen_var.w2 = _WIDTH \ 2 - gen_var.w4 \ 2 + .5
  1506.     END IF
  1507.  
  1508.     SELECT CASE gen_var.smode
  1509.         CASE 0
  1510.             oldsmode% = gen_var.smode: PCOPY 0, 1: SCREEN 0, 0, 1, 1: gen_var.smode = 1
  1511.         CASE 1
  1512.             oldsmode% = gen_var.smode: PCOPY 1, 2: SCREEN 0, 0, 2, 2: gen_var.smode = 2
  1513.     END SELECT
  1514.     PALETTE 7, 63
  1515.  
  1516.     LOCATE gen_var.w1, gen_var.w2, 0 ' Cursor hide
  1517.     FOR i = 1 TO gen_var.w3
  1518.         A$ = ""
  1519.         COLOR 15, 1
  1520.         LOCATE , gen_var.w2
  1521.         A$ = A$ + SPACE$(gen_var.w4 - LEN(A$))
  1522.         PRINT A$;
  1523.         IF i <> 1 THEN
  1524.             COLOR 1, 0: PRINT CHR$(176)
  1525.         ELSE PRINT
  1526.         END IF
  1527.     NEXT i
  1528.     LOCATE , gen_var.w2 + 1
  1529.     COLOR 1, 0: PRINT STRING$(gen_var.w4, CHR$(176));
  1530.     COLOR 14, 1
  1531.     LOCATE gen_var.w1, gen_var.w2
  1532.     PRINT CHR$(218); STRING$(gen_var.w4 - 2, CHR$(196)); CHR$(191);
  1533.     LOCATE gen_var.w1 + gen_var.w3 - 1, gen_var.w2
  1534.     PRINT CHR$(192); STRING$(gen_var.w4 - 2, CHR$(196)); CHR$(217);
  1535.     FOR i = 1 TO gen_var.w3 - 2
  1536.         LOCATE gen_var.w1 + i, gen_var.w2: PRINT CHR$(179);: LOCATE gen_var.w1 + i, gen_var.w2 + gen_var.w4 - 1: PRINT CHR$(179);
  1537.     NEXT i
  1538.  
  1539.     '''''''''''''
  1540.     IF msg% <> -2 THEN
  1541.         LOCATE gen_var.w1, gen_var.w2 + gen_var.w4 - 2: COLOR 15, 1
  1542.         yclose% = CSRLIN: xclose% = POS(0): PRINT "x";
  1543.     END IF
  1544.  
  1545.     IF LEN(msg$) OR fndrep.noif THEN
  1546.         SELECT CASE msg%
  1547.             CASE -2 ' Flash Message.
  1548.                 LOCATE gen_var.w1 + 1, gen_var.w2 + gen_var.w4 \ 2 - LEN(msg$) \ 2
  1549.                 PRINT msg$;
  1550.  
  1551.             CASE -1 ' Message title.
  1552.                 LOCATE gen_var.w1 + 1, gen_var.w2 + gen_var.w4 \ 2 - LEN(msg$) \ 2
  1553.                 PRINT msg$;
  1554.  
  1555.                 IF button% THEN GOSUB button_actions ' Yes / No would go here but save as does not use this button system, and would bypass this condition.
  1556.  
  1557.             CASE 0 ' No message title. Usually used with input fields with limited vertical space.
  1558.                 IF fndrep.noif THEN
  1559.                     fndrep.ifrow = 1
  1560.                     IF UBOUND(ifield$) > 1 THEN i% = 2: j% = UBOUND(ifield$) ELSE i% = 0: j% = 1 ' Where 2 is the spacing between input fields.
  1561.                     FOR g% = 1 TO UBOUND(ifield$)
  1562.                         LOCATE gen_var.w1 + gen_var.w3 \ 2 - j% + i% * (g% - 1), gen_var.w2 + gen_var.w4 \ 2 - (fndrep.ifield + LEN(ifield$(g%)) + 2) \ 2
  1563.                         ifieldyy%(g%) = CSRLIN: ifieldxx%(g%) = POS(0) + LEN(ifield$(g%)) + 1 ' Start of text input line.
  1564.                         COLOR 15, 1: PRINT ifield$(g%);
  1565.                         COLOR 8, 1: PRINT CHR$(222);
  1566.                         COLOR c2%, c1%: PRINT SPACE$(fndrep.ifield);
  1567.                     NEXT
  1568.                     passrightmargin% = POS(0) - 1 ' Sets right margin of the find input field.
  1569.                 END IF
  1570.  
  1571.                 IF button% THEN
  1572.                     GOSUB button_actions
  1573.                 ELSE ' No buttons present.
  1574.                     LOCATE gen_var.w1 + gen_var.w3 \ 2, gen_var.w2 + gen_var.w4 \ 2 - LEN(msg$) \ 2
  1575.                     PRINT msg$;
  1576.                 END IF
  1577.  
  1578.         END SELECT
  1579.     END IF
  1580.  
  1581.     LOCATE iyy%, ixx%
  1582.     button% = 0 ' Reset buttons.
  1583.     _KEYCLEAR
  1584.  
  1585.     IF mydelay% THEN ' Sending to printer...
  1586.         gen_var.action = "" ' Finished gen_var.action = "print" one of two.
  1587.         _DELAY mydelay%: mydelay% = 0
  1588.         gen_var.smode = oldsmode%: SCREEN 0, 0, gen_var.smode, gen_var.smode: COLOR 0, 7
  1589.     END IF
  1590.  
  1591.     EXIT SUB
  1592.  
  1593.     clear_button:
  1594.     COLOR 0, 7
  1595.     LOCATE buttonyy%, INSTR(mouselocator$, LTRIM$(STR$(h%)))
  1596.     PRINT SPACE$(1) + button$(h% + button_index%) + SPACE$(1);
  1597.     RETURN
  1598.  
  1599.     tab_and_enter_fields:
  1600.     DO
  1601.         IF tabx% = 0 AND fndrep.ifrow > 0 AND fndrep.ifrow <= UBOUND(ifield$) OR tabx% = button% AND fndrep.ifrow OR LEN(gen_var.action) AND fndrep.ifrow THEN
  1602.             IF tabx% = button% THEN ' Last tab button is highlighted. Go back to input fields.
  1603.                 h% = button%: GOSUB clear_button
  1604.                 IF fndrep.ifrow THEN ' Only for popups with input line(s).
  1605.                     entry$(fndrep.ifrow) = text$
  1606.                     tabx% = 0
  1607.                     IF fndrep.ifrow = UBOUND(ifield$) THEN fndrep.ifrow = 1 ELSE fndrep.ifrow = fndrep.ifrow + 1
  1608.                     text$ = entry$(fndrep.ifrow): _KEYCLEAR
  1609.                     LOCATE ifieldyy%(fndrep.ifrow), ifieldxx%(fndrep.ifrow), 1
  1610.                 END IF
  1611.                 b$ = ""
  1612.                 EXIT DO
  1613.             END IF
  1614.  
  1615.             ' Remove any highlighting.
  1616.             IF UBOUND(ifield$) >= 1 THEN
  1617.                 LOCATE ifieldyy%(fndrep.ifrow), ifieldxx%(fndrep.ifrow), 0
  1618.                 COLOR 7, 0
  1619.                 PRINT SPACE$(fndrep.ifield);
  1620.                 LOCATE ifieldyy%(fndrep.ifrow), ifieldxx%(fndrep.ifrow)
  1621.                 PRINT MID$(text$, 1, fndrep.ifield);
  1622.                 entry$(fndrep.ifrow) = text$
  1623.                 IF fndrep.ifrow + 1 > UBOUND(ifield$) THEN
  1624.                     tabx% = 1 ' To reloop.
  1625.                     entry$(fndrep.ifrow) = text$
  1626.                 ELSE
  1627.                     entry$(fndrep.ifrow) = text$
  1628.                     fndrep.ifrow = fndrep.ifrow + 1
  1629.                     text$ = entry$(fndrep.ifrow): _KEYCLEAR
  1630.                     LOCATE ifieldyy%(fndrep.ifrow), ifieldxx%(fndrep.ifrow), 1
  1631.                     b$ = ""
  1632.                     EXIT DO
  1633.                 END IF
  1634.             END IF
  1635.             EXIT DO
  1636.         ELSE
  1637.             tabx% = tabx% + 1
  1638.             IF tabx% > button% AND fndrep.ifrow = 0 THEN tabx% = 1 ' No input fields.
  1639.             EXIT DO
  1640.         END IF
  1641.     LOOP
  1642.  
  1643.     RETURN
  1644.  
  1645.     button_actions:
  1646.     buttonyy% = CSRLIN + 2
  1647.     j% = 0
  1648.     FOR i% = 1 TO button%
  1649.         j% = j% + LEN(button$(button_index% + i%)) + 2
  1650.     NEXT
  1651.     LOCATE buttonyy%, gen_var.w2 + gen_var.w4 \ 2 - j% \ 2 - 1
  1652.     COLOR 0, 7
  1653.     mouselocator$ = STRING$(_WIDTH, "0"): mouselocator% = buttonyy%
  1654.     k% = 0
  1655.  
  1656.     FOR i% = button_index% + 1 TO button_index% + button%
  1657.         IF k% THEN LOCATE , POS(0) + 2
  1658.         k% = k% + 1
  1659.         MID$(mouselocator$, POS(0)) = STRING$(LEN(button$(i%)) + 2, LTRIM$(STR$(k%)))
  1660.         PRINT SPACE$(LEN(button$(i%)) + 2);
  1661.     NEXT
  1662.  
  1663.     LOCATE buttonyy%, gen_var.w2 + gen_var.w4 \ 2 - j% \ 2
  1664.     COLOR 0, 7
  1665.     k% = 0
  1666.  
  1667.     ' Prints names on buttons.
  1668.     FOR i% = button_index% + 1 TO button_index% + button%
  1669.         IF k% THEN LOCATE buttonyy%, POS(0) + 4
  1670.         PRINT button$(i%);
  1671.         k% = k% + 1
  1672.     NEXT
  1673.  
  1674.     IF fndrep.find_or_replace THEN
  1675.         LOCATE ifieldyy%(fndrep.ifrow), ifieldxx%(fndrep.ifrow), 1
  1676.         tabx% = 0
  1677.         _KEYCLEAR: text$ = ""
  1678.     END IF
  1679.     ' <--------------------------
  1680.     gen_var.action = "" ' Removes all gen_var.action conditions. Waits for new actions assigned by button selection.
  1681.     DO
  1682.         IF fndrep.find_or_replace THEN
  1683.             inputfieldyy% = CSRLIN: inputfieldxx% = POS(0)
  1684.  
  1685.             '''CALL textinput(text$, passrightmargin%, mykey%, doctype_full$, inputline%, fav$(), favy%(), favx%(), doctype$(), doctype%, doctypey%(), doctypex%(), x$(), xfull$(), scrb, noe, row, scr, config%, b$, mx%, my%, doc_title$)
  1686.  
  1687.         ELSE
  1688.  
  1689.             '''CALL user(b$, mx%, my%, alt%, shift%, ctrl%, ctrlshift%, con_panel%, doc_title$, doc_saved%, scrb, scrbscrbardrag%, x$(), noe, scr, ins%, dwidth)
  1690.  
  1691.         END IF
  1692.  
  1693.         IF LEN(b$) THEN
  1694.             SELECT CASE b$
  1695.                 CASE CHR$(13)
  1696.                     IF fndrep.find_or_replace THEN
  1697.                         GOSUB tab_and_enter_fields
  1698.                         IF LEN(b$) THEN ' b$ can be made null in the gosub above. This occurs when there are still more fields to fill in.
  1699.                             SELECT CASE tabx%
  1700.                                 CASE 1
  1701.                                     fndrep.find_action = "Whole Word"
  1702.                                 CASE 2
  1703.                                     fndrep.find_action = "Whole/Case"
  1704.                                     ' Find Function only.
  1705.                                 CASE 0, 3
  1706.                                     fndrep.find_action = "Any Part"
  1707.                                 CASE 4
  1708.                                     fndrep.find_action = "Any/Case"
  1709.                             END SELECT
  1710.                         END IF
  1711.                     ELSE
  1712.                         SELECT CASE tabx%
  1713.                             CASE 1
  1714.                                 IF button_index% = 0 THEN gen_var.action = "yes"
  1715.                                 IF button_index% = 2 THEN gen_var.action = "retry"
  1716.                             CASE 2
  1717.                                 IF button_index% = 0 THEN gen_var.action = "no"
  1718.                                 IF button_index% = 2 THEN gen_var.action = "abort" ' Note: Button says cancel, but gen_var.action needs to be different to get a specific program flow.
  1719.                         END SELECT
  1720.                     END IF
  1721.                 CASE CHR$(27)
  1722.                     gen_var.action = "close"
  1723.                     IF LEN(fndrep.find_action) THEN fndrep.find_action = "" ' Remove whole, part, etc. find designations with esc key.
  1724.             END SELECT
  1725.         END IF
  1726.  
  1727.         IF LEN(gen_var.action) THEN EXIT DO '------------------------------->
  1728.  
  1729.         IF my% = gen_var.w1 AND mx% = gen_var.w2 + gen_var.w4 - 2 THEN ' Mouse located on the x button for the Find / Replace popup.
  1730.             IF closex% = 0 THEN closex% = -1: xx1% = CSRLIN: yy1% = POS(0): LOCATE my%, mx%: COLOR 15, 4: PRINT "x";: LOCATE xx1%, yy1%
  1731.         ELSE
  1732.             IF closex% THEN closex% = 0: xx1% = CSRLIN: yy1% = POS(0): LOCATE gen_var.w1, gen_var.w2 + gen_var.w4 - 2: COLOR 7, 1: PRINT "x";: LOCATE xx1%, yy1%
  1733.         END IF
  1734.  
  1735.         IF bhl% THEN IF bhl% = 1 AND my% <> mouselocator% OR bhl% = 1 AND MID$(mouselocator$, mx%, 1) = "0" THEN tabx% = 0: bhl% = 0
  1736.  
  1737.         IF b$ = CHR$(9) THEN GOSUB tab_and_enter_fields
  1738.  
  1739.         IF oldmx% = mx% AND oldmy% = my% THEN i% = 0 ELSE i% = -1 ' Mouse has moved.
  1740.  
  1741.         IF b$ = CHR$(9) OR my% = mouselocator% AND MID$(mouselocator$, mx%, 1) <> "0" AND i% THEN
  1742.             IF b$ = CHR$(9) THEN k% = tabx%: bhl% = 9 ELSE k% = VAL(MID$(mouselocator$, mx%, 1)): tabx% = k%: bhl% = 1
  1743.             IF fndrep.find_or_replace THEN LOCATE , , 0 ' Hide cursor while making buttons.
  1744.  
  1745.             IF h% AND h% <> tabx% THEN
  1746.                 entry$(fndrep.ifrow) = text$
  1747.                 GOSUB clear_button
  1748.             END IF
  1749.  
  1750.             h% = k%: tabx% = h%
  1751.  
  1752.             COLOR 0, 3
  1753.             LOCATE buttonyy%, INSTR(mouselocator$, LTRIM$(STR$(h%)))
  1754.             PRINT SPACE$(1) + button$(h% + button_index%) + SPACE$(1);
  1755.  
  1756.             IF fndrep.find_or_replace THEN LOCATE inputfieldyy%, inputfieldxx%
  1757.  
  1758.             _DELAY .15
  1759.         ELSE
  1760.             IF h% AND tabx% = 0 THEN
  1761.                 iyy% = CSRLIN: ixx% = POS(0)
  1762.                 IF fndrep.find_or_replace THEN LOCATE , , 0
  1763.                 COLOR 0, 7
  1764.                 LOCATE buttonyy%, INSTR(mouselocator$, LTRIM$(STR$(h%)))
  1765.                 PRINT SPACE$(1) + button$(h% + button_index%) + SPACE$(1);
  1766.                 LOCATE iyy%, ixx%
  1767.                 h% = 0: tabx% = 0
  1768.             END IF
  1769.         END IF
  1770.  
  1771.         IF mb.l THEN
  1772.             IF closex% THEN
  1773.                 IF LEN(fndrep.find_action) THEN fndrep.find_action = "" ' Remove whole, part, etc. find designations with x mouse click.
  1774.                 SOUND 1000, .1: closex% = 0
  1775.                 gen_var.action = "close" ' This will be changed later to "close retry" for 3rd level popups like file already exists. Overwrite?
  1776.             END IF
  1777.  
  1778.             IF my% = mouselocator% AND MID$(mouselocator$, mx%, 1) <> "0" THEN
  1779.                 SOUND 1000, .1
  1780.                 SELECT CASE VAL(MID$(mouselocator$, mx%, 1))
  1781.                     CASE 1
  1782.                         IF button_index% = 0 THEN gen_var.action = "yes"
  1783.                         IF button_index% = 2 THEN gen_var.action = "retry"
  1784.                         IF button_index% = 4 THEN
  1785.                             IF config% = 2 THEN gen_var.action = "find"
  1786.                             IF config% = 3 THEN gen_var.action = "replace"
  1787.                             fndrep.find_action = "Whole Word": GOSUB tab_and_enter_fields ' F3 Find option.
  1788.                         END IF
  1789.                     CASE 2
  1790.                         IF button_index% = 0 THEN gen_var.action = "no"
  1791.                         IF button_index% = 2 THEN gen_var.action = "abort"
  1792.                         IF button_index% = 4 THEN
  1793.                             IF config% = 2 THEN gen_var.action = "find"
  1794.                             IF config% = 3 THEN gen_var.action = "replace"
  1795.                             fndrep.find_action = "Whole/Case": GOSUB tab_and_enter_fields ' F3 Find option.
  1796.                         END IF
  1797.                         ' Find Function only.
  1798.                     CASE 3
  1799.                         IF button_index% = 4 THEN
  1800.                             IF config% = 2 THEN gen_var.action = "find"
  1801.                             IF config% = 3 THEN gen_var.action = "replace"
  1802.                             fndrep.find_action = "Any Part": GOSUB tab_and_enter_fields ' F3 Find option.
  1803.                         END IF
  1804.                     CASE 4
  1805.                         IF button_index% = 4 THEN
  1806.                             IF config% = 2 THEN gen_var.action = "find"
  1807.                             IF config% = 3 THEN gen_var.action = "replace"
  1808.                             fndrep.find_action = "Any/Case": GOSUB tab_and_enter_fields ' F3 Find option.
  1809.                         END IF
  1810.                 END SELECT
  1811.             END IF
  1812.  
  1813.             IF mb.l AND fndrep.noif > 1 THEN
  1814.                 IF mx% >= ifieldxx%(1) AND mx% <= ifieldxx%(1) + fndrep.ifield AND my% >= ifieldyy%(1) AND my% <= ifieldyy%(UBOUND(ifield$)) THEN
  1815.                     entry$(fndrep.ifrow) = text$
  1816.                     fndrep.ifrow = 0
  1817.                     FOR i% = 1 TO UBOUND(ifield$)
  1818.                         IF my% = ifieldyy%(i%) THEN fndrep.ifrow = i%: EXIT FOR
  1819.                     NEXT
  1820.                     '''''''''''''''''''''''''''
  1821.                     ' IMPORTANT: THIS ERRORED ONCE, BUT I WAS UNABLE TO EASILY REPEAT IT.
  1822.                     IF fndrep.ifrow = 0 THEN CLS: PRINT "Error in fndrep.ifrow.": END '''
  1823.                     IF mx% <= ifieldxx%(fndrep.ifrow) + LEN(text$) THEN LOCATE my%, mx%, 1 ELSE LOCATE my%, ifieldxx%(fndrep.ifrow) + LEN(text$)
  1824.                     text$ = entry$(fndrep.ifrow)
  1825.                 END IF
  1826.             END IF
  1827.  
  1828.         END IF
  1829.  
  1830.         IF b$ = CHR$(9) THEN b$ = "" ' Note: b$ = "" may not be necessary but works as a precaution.
  1831.         oldmy% = my%: oldmx% = mx%
  1832.     LOOP UNTIL LEN(gen_var.action) ' Note: A 2nd exit do with len(gen_var.action) is present in the inkey portion of this loop.
  1833.  
  1834.     gen_var.smode = oldsmode%: SCREEN 0, 0, gen_var.smode, gen_var.smode: COLOR 0, 7
  1835.     RETURN
  1836.  
  1837.  
  1838. FUNCTION Button_HW (wide, tall, r, g, b, rc, gc, bc, caption$)
  1839.     ' Button function courtesy of the Amazing Steve.
  1840.     Dest = _DEST
  1841.     t = _NEWIMAGE(wide, tall, 32)
  1842.     _DEST t
  1843.     FOR i = 0 TO 10
  1844.         rm = rm + rc
  1845.         gm = gm + gc
  1846.         bm = bm + bc
  1847.         k = _RGB32(r + rm, g + gm, b + bm)
  1848.         LINE (x + i, y + i)-(x + wide - i, y + tall - i), k, B
  1849.     NEXT
  1850.     PAINT (x + i, y + i), k
  1851.     COLOR _RGB32(r, g, b), 0
  1852.     _PRINTSTRING (x + (wide - _PRINTWIDTH(caption$)) / 2, y + (tall - _FONTHEIGHT) / 2), caption$
  1853.     Button_HW = _COPYIMAGE(t, 33)
  1854.     _FREEIMAGE t
  1855.  
  1856.     _DEST Dest
  1857.  
  1858. SUB setvariables (scrb AS my_scrb, c1%, c2%, c1alt%, h1%, h2%, row, ins%, dwidth, dwidth2, menubar%, menuheightmax%)
  1859.     menubar% = 1 ' Menu bar location.
  1860.  
  1861.     SELECT CASE gen_var.vartable
  1862.         CASE 1 ' Text Editor
  1863.             margin.t = 2
  1864.             margin.b = 1
  1865.             margin.l = 2
  1866.             margin.r = 3
  1867.             ins% = 7
  1868.             ovm% = 1 ' Change this to 0 for no over margin cursoring. 0 needed if right margin is at edge of screen.
  1869.             c1% = 0: c2% = 7: h1% = 15: h2% = 1 ' Normal text and highlighted text colors.
  1870.             scrn.w = _WIDTH
  1871.             scrn.h = _HEIGHT
  1872.             page.w = scrn.w - (margin.l + margin.r)
  1873.             page.h = scrn.h - (margin.t + margin.b)
  1874.             scrb.t = margin.t + 1
  1875.             scrb.b = margin.t + page.h
  1876.             scrb.l = margin.l + page.w + 2
  1877.             scrb.d = scrb.b - scrb.t + 1
  1878.             scrb.h = scrb.b - scrb.t - 1 ' Max. vertical scroll. Bar minus the top and bottom arrow symbols.
  1879.             dwidth = scrn.w - (margin.l + margin.r): dwidth2 = dwidth + 2
  1880.             c1alt% = c1% + c2% * 16
  1881.             IF row = 0 THEN row = 1
  1882.             IF page.c = 0 THEN page.c = 7 ' Cursor apearance as underline.
  1883.  
  1884.         CASE 2 ' Popup operations. Margins control the file display window but not the input line.
  1885.             scrn.h = 25
  1886.             margin.t = 4
  1887.             margin.b = 12
  1888.             margin.l = 11
  1889.             margin.r = 12
  1890.             dwidth = scrn.w - (margin.l + margin.r): dwidth2 = dwidth + 2
  1891.             c1% = 7: c2% = 0: h1% = 15: h2% = 1 ' Normal text and highlighted text colors.
  1892.             scrn.w = _WIDTH
  1893.             scrn.h = _HEIGHT
  1894.             page.w = scrn.w - (margin.l + margin.r)
  1895.             page.h = scrn.h - (margin.t + margin.b)
  1896.             scrb.x = 0 ' Relative position of the scrollbar cursor from top of scrb.h. 0 Off / 1 to
  1897.             scrb.t = margin.t + 1
  1898.             scrb.b = margin.t + page.h
  1899.             scrb.l = margin.l + page.w + 2
  1900.             scrb.d = scrb.b - scrb.t + 1
  1901.             scrb.h = scrb.b - scrb.t - 1 ' Max. vertical scroll. Bar minus the top and bottom arrow symbols.
  1902.             menuheightmax% = scrn.h - 4
  1903.  
  1904.         CASE 3 ' Font colors.
  1905.             scrn.h = 25
  1906.             margin.t = 15
  1907.             margin.b = 6
  1908.             margin.l = 15
  1909.             margin.r = 16
  1910.             scrn.w = _WIDTH
  1911.             scrn.h = _HEIGHT
  1912.             page.w = scrn.w - (margin.l + margin.r)
  1913.             page.h = scrn.h - (margin.t + margin.b)
  1914.             menuheightmax% = scrn.h - 4
  1915.  
  1916.         CASE 4 ' Font types.
  1917.             scrn.h = 25
  1918.             margin.t = 15
  1919.             margin.b = 4
  1920.             margin.l = 15
  1921.             margin.r = 16
  1922.             scrn.w = _WIDTH
  1923.             scrn.h = _HEIGHT
  1924.             page.w = scrn.w - (margin.l + margin.r)
  1925.             page.h = scrn.h - (margin.t + margin.b)
  1926.             scrb.x = 0 ' Relative position of the scrollbar cursor from top of scrb.h. 0 Off / 1 to
  1927.             scrb.t = margin.t + 1
  1928.             scrb.b = margin.t + page.h
  1929.             scrb.l = margin.l + page.w + 2
  1930.             scrb.d = scrb.b - scrb.t + 1
  1931.             scrb.h = scrb.b - scrb.t - 1 ' Max. vertical scroll. Bar minus the top and bottom arrow symbols.
  1932.             menuheightmax% = scrn.h - 4
  1933.     END SELECT
  1934.  
  1935.  
  1936. SUB scrollbar_update (h%, scrb AS my_scrb, noe AS INTEGER, row, scr)
  1937.     STATIC thumb%
  1938.     ' h% = 0 No thumb position calculation required, just remake bar.
  1939.     ' h% = 1 Calculate thumb position.
  1940.     ' h% = 999. Reset STATIC thumb% to zero and exit.
  1941.     ' This sub utilizes exit subs.
  1942.  
  1943.     dc% = _DEFAULTCOLOR
  1944.     bc% = _BACKGROUNDCOLOR
  1945.  
  1946.     IF h% THEN ' Places thumb or resets thumb
  1947.         IF h% = 999 THEN thumb% = 0: EXIT SUB ' Resets thumb.
  1948.         IF scrb.opt = 0 THEN
  1949.             scrb.s = (scrb.h + 1) * 2 - noe: IF scrb.s <= 0 THEN scrb.s = 1
  1950.         ELSE
  1951.             scrb.s = 1
  1952.         END IF
  1953.  
  1954.         IF scr = 0 THEN
  1955.             scrb.x = 0
  1956.         ELSE
  1957.             IF scrb.x < page.h - 3 AND page.h + scr >= INT((scrb.x + 1) * ((noe - scrb.d) / (scrb.h - scrb.s))) + page.h THEN
  1958.                 scrb.x = 0
  1959.                 DO UNTIL scrb.x = scrb.h - scrb.s OR page.h + scr < INT((scrb.x + 1) * ((noe - scrb.d) / (scrb.h - scrb.s))) + page.h
  1960.                     scrb.x = scrb.x + 1
  1961.                 LOOP
  1962.  
  1963.             ELSEIF row + scr < scrb.i THEN
  1964.                 scrb.x = page.h - 3
  1965.                 DO UNTIL page.h + scr > INT((scrb.x + 1 - 2) * ((noe - scrb.d) / (scrb.h - scrb.s))) + page.h
  1966.                     scrb.x = scrb.x - 1
  1967.                 LOOP
  1968.             END IF
  1969.         END IF
  1970.  
  1971.         IF scrb.x + scrb.s > scrb.h THEN ' Scrollbox expansion adjustment.
  1972.             scrb.x = scrb.h - scrb.s
  1973.         END IF
  1974.  
  1975.         scrb.i = INT(scrb.x * ((noe - scrb.d) / (scrb.h - scrb.s)))
  1976.     END IF
  1977.  
  1978.     ' Makes scrollbar and displays thumb.
  1979.     IF scrb.t + scrb.x + 1 <> thumb% OR scrb.s = 0 THEN ' scrb.s = 0 allows thumb to be removed if text deletion makes doc less than page height.
  1980.         IF scrb.s = 0 THEN thumb% = 0
  1981.         yy% = CSRLIN: xx% = POS(0)
  1982.         LOCATE scrb.t, scrb.l
  1983.         COLOR 0, 7
  1984.         PRINT CHR$(24); ' Arrow up
  1985.         COLOR 7, 0
  1986.         FOR i% = 1 TO scrb.h ' Bar
  1987.             LOCATE scrb.t + i%, scrb.l
  1988.             PRINT CHR$(177);
  1989.         NEXT i%
  1990.         LOCATE scrb.b, scrb.l
  1991.         COLOR 0, 7
  1992.         PRINT CHR$(25); ' Arrow down
  1993.         COLOR 7, 0
  1994.  
  1995.         IF noe > scrb.h + 2 THEN
  1996.             IF scrb.s THEN thumb% = scrb.t + scrb.x + 1
  1997.             FOR i% = 1 TO scrb.s
  1998.                 LOCATE scrb.t + scrb.x + i%, scrb.l
  1999.                 COLOR 1, 0
  2000.                 PRINT CHR$(176); ' Scrollbar thumb aka box.
  2001.             NEXT
  2002.             COLOR 7, 0
  2003.         END IF
  2004.         LOCATE yy%, xx%
  2005.     END IF
  2006.     COLOR dc%, bc%
  2007.  

Thanks to Steve for the graphics button function. It works great in SCREEN 0! I tweaked the button colors a bit to work with popup colors. This is just the skin, the guts will take some time to build.

Pete
« Last Edit: March 25, 2021, 10:29:04 pm by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Working on an interface for a wordpad print routine.
« Reply #1 on: March 21, 2021, 12:53:45 am »
Changed the color layout just a bit. Added mouse and tab keys. Needs Enter and arrow keys added, and then the gut to the input fields. Slow going, due to very little programming time these days.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline euklides

  • Forum Regular
  • Posts: 128
    • View Profile
Re: Working on an interface for a wordpad print routine.
« Reply #2 on: March 21, 2021, 05:18:36 am »
Don't understand how to use this...
Why not yes ?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Working on an interface for a wordpad print routine.
« Reply #3 on: March 21, 2021, 11:38:40 am »
Wow Pete, looks like a VBDOS GUI and maybe in some places better! scroll bars in input slots, nice touch!

Don't understand how to use this...

As Pete has said, an interface to printing in WordPad as maybe a popup? Not sure how Pete plans to conjure the genie but very interesting to see you can select your own font and the other options with that color and size. Update: oh after the file has been created, just call it (a file to print) up from a File Dialog.

Page counts are going to be different according to font settings, so how can one select a page or range without preview?

  [ You are not allowed to view this attachment ]  

@Pete as STx has suggested, you're hired to build an IDE for the oh interpreter :)
« Last Edit: March 21, 2021, 11:57:43 am by bplus »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Working on an interface for a wordpad print routine.
« Reply #4 on: March 21, 2021, 01:50:32 pm »
@bplus Mark, thanks for the kind words, and putting up a screen shot.

Don't understand how to use this...

It isn't ready to be used, which is why it's not in the "programs" section. It's a work in progress I will be adding to my WP project. By using rtf formatting, the WP docs will have more printing options than what is available through the very limited printing abilities of the QB64 language, especially since printer esc codes are no longer available to us, as they were in QBasic.

I separated this project from the WP, so that it could, when finished, be used by others who just want a way to use WordPad to print any of their QB64 text programs.

As for things like page numbering, that will also be handled by WordPad. In other words, it will calculate the font size, type, etc. and  print the number to the bottom of each page.  Worst case scenario, it will mean hacking into the API to check that option n WordPAd, but I do know some rtf page formatting. So far, I have it printing the page number, but not centered. Unfortunately, not all MS Word rtf formatting is accepted by WordPad. Well, I'll cross those bridges when I finish this interface. I might need some help from Indy when I get there.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Working on an interface for a wordpad print routine.
« Reply #5 on: March 22, 2021, 04:55:00 pm »
Updated the code. See edit in the post.

Hey, do you guys think the arrow up should increase or reduce the values? Try the way I have it, and see if it seems intuitive or should be reversed.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Working on an interface for a wordpad print routine.
« Reply #6 on: March 22, 2021, 05:08:31 pm »
Hey, do you guys think the arrow up should increase or reduce the values? Try the way I have it, and see if it seems intuitive or should be reversed.

@Pete Yeah, it seems weird to have the up arrow decrease the values
Shuwatch!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Working on an interface for a wordpad print routine.
« Reply #7 on: March 22, 2021, 06:01:00 pm »
Concur, up is more, just like thermometer and stocks.

Come to think of it, TV remote is backwards.
« Last Edit: March 22, 2021, 06:12:29 pm by bplus »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Working on an interface for a wordpad print routine.
« Reply #8 on: March 22, 2021, 06:31:26 pm »
If it’s a list, up decreases the value and down increases it.   Just watch your line numbers in the IDE with any program, if you need an example.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Working on an interface for a wordpad print routine.
« Reply #9 on: March 22, 2021, 06:49:31 pm »
Well now consider the scroll bar, mouse wheel push  wheel up, screen rolls up, push wheel down screen moves down.

They are scroll bars there on right, right?

Yeah but on list or document lower is higher. :P

I just checked font size, it increases going down.

« Last Edit: March 22, 2021, 06:53:38 pm by bplus »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Working on an interface for a wordpad print routine.
« Reply #10 on: March 22, 2021, 09:49:54 pm »
Thanks guys! I switched it.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Working on an interface for a wordpad print routine.
« Reply #11 on: March 23, 2021, 09:25:59 pm »
Edit: New additions were added to the original post.
« Last Edit: March 25, 2021, 12:12:29 am by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Working on an interface for a wordpad print routine.
« Reply #12 on: March 25, 2021, 10:27:06 am »
Finished! Edited the original post. Next step is to try and incorporate all of this into the WP.

Pete
« Last Edit: March 25, 2021, 07:27:22 pm by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Working on an interface for a wordpad print routine.
« Reply #13 on: March 27, 2021, 02:00:38 am »
@Pete Thanks for scrollers! they are nice. ;-))

When press print, is that the line going to the printer?

Have you considered a Sample of Font, Size and Color?