Author Topic: Scroll Bar  (Read 16110 times)

0 Members and 1 Guest are viewing this topic.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Scroll Bar
« Reply #60 on: September 23, 2019, 06:09:28 pm »
OFFTOPIC - Steve your next video tutorial is in perfect quality! I see it tomorrow!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Scroll Bar
« Reply #61 on: September 30, 2019, 04:40:03 pm »
So it took a little longer, I didn't have so much time and finally I didn't want much ... and unfortunately I came across a STRING error again. A STRING error is resolved by adding * 10 in the TB2 field definition in the X / Y Slider. Thus, I understand the meaning of STRING * 10 for writing to a file, but I do not understand the meaning of STRING * 10 when writing to memory when the subsequent string is as long as you like. Well, if you remove * 10 from the field definition, you won't color the text and the program will start doing unexpected things. Perhaps we can find the reason for the error, this program is much simpler than the previous one, where the same error manifested itself differently.

So the programs. The XY slider creates a text box at the X, Y position, with the option of scrolling the X and Y axes and coloring the text in / 15 = white for a 256 color screen with the basic color palette, or / 4294967295 in 32bit screen for white color. The number of slider windows is unlimited. The only limit is the size of your RAM.

The slider X program is older and listed here (but the version above has some bugs that the new version no longer contains). It is a one-line slider for text only in the X axis, also with the same colored text option.


XY slider:

Code: QB64: [Select]
  1.  
  2.  
  3. 'this is future "TextBox.BI"
  4. TYPE Colored '                      This Array contains colors positions on text and color values. This array is created in SUB CString.
  5.     onpos AS INTEGER
  6.     clr AS _UNSIGNED LONG
  7.     flag AS INTEGER
  8.     row AS INTEGER
  9. REDIM SHARED k(0) AS Colored
  10.  
  11. TYPE TB2
  12.     X AS INTEGER '   X position graphic coord
  13.     Y AS INTEGER '   Y position graphic coord
  14.     L AS INTEGER '   TextBox lenght
  15.     H AS INTEGER '   Textbox HEIGHT                                            NEW
  16.     T AS STRING * 10 '    TextBox text                                                            AGAIN STRING BUG!!!!!! DELETE *10 and run this program for really unexpected outputs!
  17.     B AS INTEGER '   Text begin in textbox  (for shift), X axis
  18.     BH AS INTEGER '  Text begin in textbox  (for shift), Y axis                NEW
  19.  
  20.     D AS SINGLE '    for time delay between click to arrows
  21.     I_s AS INTEGER
  22.     I_e AS INTEGER
  23.     filter AS _BYTE 'new info flag for CString, which is needed just in the start, but not more.
  24.  
  25. REDIM SHARED TBA2(0) AS TB2
  26. REDIM SHARED GlobalText(0) AS STRING 'spolecne obrovske textove pole obsahujici texty pro vsechna okna vcetne udaju o barvach
  27. DIM SHARED Arrow0 AS LONG, Arrow1 AS LONG, Arrow2 AS LONG, Arrow3 AS LONG
  28.  
  29.  
  30. SCREEN _NEWIMAGE(800, 600, 256) 'screen must be initialized before PutArrow& is run.
  31. Arrow0 = PutArrow
  32. R90 Arrow0, Arrow1, Arrow2, Arrow3 'create four arrows in four directions from first source image
  33. 'end of future "TextBox.BI"
  34.  
  35.  
  36.  
  37.  
  38. DIM Text1(7) AS STRING
  39. DIM Text2(14) AS STRING
  40.  
  41. Text1(1) = "/14This is content /1for /2array /3Text1. Original and source text array content is in"
  42. Text1(2) = "/44array Text1. Because Petr can just 2 ways (first: MEM Pointer to array insert"
  43. Text1(3) = "/45to type), or second, easyest - all texts insert to one STRING SHARED array, and"
  44. Text1(4) = "/46writing informations about start and end index to TYPE, is now this text also"
  45. Text1(5) = "/47inserted to array named as GlobalText. Because this text contains 7 rows and "
  46. Text1(6) = "/48Text1 array is inserted as first, is this saved in indexes 0 to 6 in array"
  47. Text1(7) = "/49GlobalText. Info about this records are here saved to TBA2().I_s and TBA2().I_e"
  48.  
  49.  
  50.  
  51. Text2(1) = "                /14   Example for use:"
  52. Text2(2) = "/40 With '/40/' and then number you set colors. If you use _SCREEN _NEWIMAGE in 256 colors,"
  53. Text2(3) = "then use number from 0 to 256. But if you use 32 bit screen, then dont use &H values but"
  54. Text2(4) = "/50 number. This number can be returned using this easy source code:"
  55. Text2(5) = "/55 COLOR~& = &HFFFFFFFF  /60 or /55 COLOR~& = _RGBA32(255, 255, 255)"
  56. Text2(6) = "PRINT COLOR~&. /60 This is number, which you need for use to 32 bit screens with this"
  57. Text2(7) = "easy program. (i write soon automatic translator for it, but with my time....)/9"
  58. Text2(8) = "Program construction: - All strings are saved to array /14 GlobalText."
  59. Text2(9) = "                     /9 - Function /14R90/9 create 4 images which contains rows, rotated from 1"
  60. Text2(10) = "                       source image, which is created with Function /14PutArrow./9"
  61. Text2(11) = "                     - /14CString /9SUB create help array for colors used in text to array /14K/9."
  62. Text2(12) = "                     - /14MaximalRowLenght/9 Function return lenght of longest row in text array."
  63. Text2(13) = "                     - Function /14INITBOX2/9 write all needed records to program arrays and return record number."
  64. Text2(14) = "                     - /14XY_BOX /9SUB - own program. Study it /33yourself /40:-)"
  65.  
  66.  
  67. A = INITBOX2(100, 50, Text1(), 10, 8)
  68. B = INITBOX2(300, 50, Text1(), 30, 6)
  69. C = INITBOX2(100, 250, Text2(), 20, 15)
  70. D = INITBOX2(350, 180, Text2(), 50, 26)
  71.  
  72.  
  73.  
  74.     XY_BOX A
  75.     XY_BOX B
  76.     XY_BOX C
  77.     XY_BOX D
  78.     _DISPLAY
  79.     _LIMIT 60
  80.  
  81.  
  82.  
  83. 'this is future "TextBox.BM"
  84. FUNCTION INITBOX2 (X AS INTEGER, Y AS INTEGER, Text() AS STRING, BoxLenght AS INTEGER, BoxHeight AS INTEGER) 'X, Y are GRAPHIC coordinates
  85.     UTB = UBOUND(tba2)
  86.     REDIM _PRESERVE TBA2(UTB + 1) AS TB2
  87.     TBA2(UTB + 1).X = X
  88.     TBA2(UTB + 1).Y = Y
  89.     TBA2(UTB + 1).L = BoxLenght
  90.     TBA2(UTB + 1).H = BoxHeight
  91.  
  92.  
  93.  
  94.  
  95.     TBA2(UTB + 1).T = ""
  96.     U1 = UBOUND(globaltext)
  97.     U2 = UBOUND(text)
  98.  
  99.     TBA2(UTB + 1).I_s = U1
  100.     TBA2(UTB + 1).I_e = U1 + U2
  101.  
  102.     REDIM _PRESERVE GlobalText(U1 + U2 + 1) AS STRING
  103.  
  104.     FOR insert = U1 TO U1 + U2
  105.         GlobalText(insert) = Text(t)
  106.         t = t + 1
  107.     NEXT
  108.  
  109.     TBA2(UTB + 1).BH = U1 + 1 'after first start: first row (BH is shift in Y, B is shift in X axis)
  110.     TBA2(UTB + 1).B = 1 'and first column
  111.     INITBOX2 = UTB + 1
  112.  
  113.  
  114. SUB XY_BOX (nr AS LONG)
  115.     '256/32 color support:
  116.  
  117.         CASE 0: BEEP: PRINT "Text mode not supported by PRINTBOX!": _DISPLAY: SLEEP 3: END
  118.         CASE 1
  119.             Black~& = 0
  120.             White~& = 15
  121.             Grey~& = 24
  122.             Grey2~& = 19
  123.         CASE 4
  124.             Black~& = &HFF000000
  125.             White~& = &HFFFFFFFF
  126.             Grey~& = &H226666666
  127.             Grey2~& = &HFF221122
  128.     END SELECT
  129.  
  130.  
  131.     RowLen = MaximalRowLenght(nr)
  132.     TextLenght = RowLen * _FONTWIDTH
  133.     B = TBA2(nr).B
  134.     BH = TBA2(nr).BH
  135.  
  136.     TextHeight = _FONTHEIGHT
  137.     X = TBA2(nr).X
  138.     Y = TBA2(nr).Y
  139.     BoxLenght = TBA2(nr).L - 2
  140.     BoxHeight = 1 + TBA2(nr).H * _FONTHEIGHT
  141.  
  142.         mwh = mwh + _MOUSEWHEEL
  143.         IF mwh THEN EXIT WHILE
  144.     WEND
  145.  
  146.     IF _MOUSEX >= X - 30 AND _MOUSEX <= X + 30 + BoxLenght * _FONTWIDTH THEN
  147.         IF _MOUSEY >= Y - 3 AND _MOUSEY <= Y + 3 + 2 * TextHeight THEN
  148.             B = B + mwh * 4
  149.         END IF
  150.     END IF
  151.  
  152.  
  153.     '
  154.     MB1 = _MOUSEBUTTON(1)
  155.     MX = _MOUSEX
  156.     MY = _MOUSEY
  157.  
  158.  
  159.  
  160.  
  161.     LINE (X - 30, Y)-(X + 30 + BoxLenght * _FONTWIDTH, Y + BoxHeight), Grey~&, BF 'vnitrek okna                                   window inside
  162.     LINE (X - 30, Y - 3)-(X + 30 + BoxLenght * _FONTWIDTH, Y + BoxHeight), White~&, B
  163.     LINE (X - 28, Y - 1)-(X + 28 + BoxLenght * _FONTWIDTH, Y + BoxHeight - TextHeight), White~&, B
  164.  
  165.     'borders for lines up / down
  166.     LINE (X + 30 + BoxLenght * _FONTWIDTH, Y - 1)-(X + 11 + BoxLenght * _FONTWIDTH, Y + BoxHeight - TextHeight), White~&, B
  167.  
  168.  
  169.     '  slider X calculations. For calculating slider lenght you need the number of characters of the longest sentence used in the box. MaximalRowLenght function return it:
  170.     '////////////////////////////////////////////////////////
  171.     TL = B / RowLen * 100 'pocatecni poloha pruhu v procentech            begining position for bottom box (percentually)
  172.     L = TBA2(nr).L * _FONTWIDTH 'celkova delka pruhu v pixelech           total slide lenght in pixels
  173.     Actual = _CEIL(X + (TL / 100 * L)) '                                  graphic position for bottom box
  174.     boxl = BoxLenght * _FONTWIDTH
  175.     BL = boxl / (TextLenght / 100) 'delka posuvneho boxiku  v procentech     box on bottom lenght  (how it is done: Slider lenght is percentually size as window bottom (for X - Shift).
  176.     '                                                                        if 30 percent of the sentence length is visible in the window, then the slider is 30 percent of the length of the X-side this window
  177.     IF BL > 100 THEN BL = 100 '                                              if text lenght < window X side, draw slider as 100 percent of X window side
  178.  
  179.     BBL = boxl / 100 * BL
  180.  
  181.     'posuvnik X        Slider X
  182.     LINE (Actual, Y + BoxHeight - TextHeight + 5)-(Actual + BBL, Y + BoxHeight - TextHeight + 12), White~&, BF
  183.     LINE (Actual, Y + BoxHeight - TextHeight + 5)-(Actual + BBL, Y + BoxHeight - TextHeight + 12), Grey2~&, B
  184.     '////////////////////////////////////////////////////////////
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.     'slider Y (the same os for X slider)
  192.     DelkaSteny = BoxHeight - TextHeight - (2 * _FONTHEIGHT) - 2
  193.     ZaznamuNaStenu = DelkaSteny / _FONTHEIGHT
  194.     Zaznamu100 = ZaznamuNaStenu / (TBA2(nr).I_e - TBA2(nr).I_s) * 100
  195.     BBH = (Zaznamu100 / 100) * DelkaSteny
  196.     IF BBH > DelkaSteny THEN BBH = DelkaSteny
  197.  
  198.     Pozice = 1 + (BH - TBA2(nr).I_e) / TBA2(nr).I_e
  199.     actualH = Y + _FONTHEIGHT + ((DelkaSteny - BBH) * Pozice)
  200.  
  201.  
  202.     'posuvnik Y        Slider Y
  203.     LINE (TBA2(nr).X + TBA2(nr).L * _FONTWIDTH, actualH)-(TBA2(nr).X + TBA2(nr).L * _FONTWIDTH + 7, actualH + BBH), White~&, BF
  204.     LINE (TBA2(nr).X + TBA2(nr).L * _FONTWIDTH, actualH)-(TBA2(nr).X + TBA2(nr).L * _FONTWIDTH + 7, actualH + BBH), Grey2~&, B
  205.  
  206.  
  207.  
  208.     ' solution for moving text by click + move to down box
  209.     IF MX >= X AND MX <= X + _FONTWIDTH * (TBA2(nr).L - 2) THEN
  210.         IF MY >= Y + BoxHeight - TextHeight AND MY <= Y + BoxHeight THEN
  211.             IF MB1 THEN
  212.                 omx = MX
  213.                 DO UNTIL _MOUSEX <> MX
  214.                     WHILE _MOUSEINPUT: WEND
  215.                     MB1 = _MOUSEBUTTON(1)
  216.                     B = B + _MOUSEX - omx
  217.                 LOOP
  218.             END IF
  219.         END IF
  220.     END IF
  221.  
  222.     ' solution for moving text up and down by clicking and move to box on right
  223.     IF MX >= X + 10 + BoxLenght * _FONTWIDTH AND MX <= X + 30 + BoxLenght * _FONTWIDTH THEN
  224.         IF MY >= Y + 16 AND MY <= Y + BoxHeight - 40 THEN
  225.             IF MB1 THEN
  226.                 omy = MY
  227.                 DO UNTIL _MOUSEY <> MY
  228.                     WHILE _MOUSEINPUT: WEND
  229.                     MB1 = _MOUSEBUTTON(1)
  230.                     BH = BH + _MOUSEY - omy
  231.                 LOOP
  232.             END IF
  233.         END IF
  234.     END IF
  235.  
  236.     ABY = Y + 2 + BoxHeight - TextHeight '                  ArrowBottomY coordinate
  237.     LUPAC = X + 15 + BoxLenght * _FONTWIDTH '               Left UP/Down Arrow coordinate
  238.  
  239.     _PUTIMAGE (LUPAC, ABY), Arrow0& '                              Arrow to right
  240.     _PUTIMAGE (X - 27, ABY + 1), Arrow1& '                                  left
  241.     _PUTIMAGE (LUPAC, Y + 2), Arrow3& '                                     up
  242.     _PUTIMAGE (LUPAC - 1, Y + TextHeight * (TBA2(nr).H - 2)), Arrow2& '     down
  243.  
  244.     IF TIMER < 1 THEN TBA2(nr).D = 0
  245.  
  246.     'driving up arrow
  247.     IF MX >= LUPAC AND MX <= LUPAC + 12 THEN
  248.         IF MY >= Y + 2 AND MY <= Y + 14 THEN
  249.             IF TBA2(nr).D < TIMER THEN
  250.                 IF _PIXELSIZE = 4 THEN
  251.                     LINE (LUPAC, Y + 2)-(LUPAC + 12, Y + 14), &H44FFFFFF, BF
  252.                 ELSE
  253.                     LINE (LUPAC, Y + 2)-(LUPAC + 12, Y + 14), 14, B
  254.                 END IF
  255.                 IF MB1 THEN BH = BH - 1
  256.                 TBA2(nr).D = TIMER + .01
  257.                 MB1 = 0
  258.             END IF
  259.         END IF
  260.     END IF
  261.  
  262.     'driving down arrow
  263.     IF MX >= LUPAC - 1 AND MX <= LUPAC + 11 THEN
  264.         IF MY >= Y + TextHeight * (TBA2(nr).H - 2) AND MY <= 12 + Y + TextHeight * (TBA2(nr).H - 2) THEN
  265.             IF TBA2(nr).D < TIMER THEN
  266.                 IF _PIXELSIZE = 4 THEN
  267.                     LINE (LUPAC - 1, Y + TextHeight * (TBA2(nr).H - 2))-(LUPAC + 11, 12 + Y + TextHeight * (TBA2(nr).H - 2)), &H44FFFFFF, BF
  268.                 ELSE
  269.                     LINE (LUPAC - 1, Y + TextHeight * (TBA2(nr).H - 2))-(LUPAC + 11, 12 + Y + TextHeight * (TBA2(nr).H - 2)), 14, B
  270.                 END IF
  271.                 IF MB1 THEN BH = BH + 1
  272.                 TBA2(nr).D = TIMER + .01
  273.                 MB1 = 0
  274.             END IF
  275.         END IF
  276.     END IF
  277.  
  278.  
  279.  
  280.     'driving right arrow on bottom
  281.     IF MX >= LUPAC AND MX <= LUPAC + 12 THEN
  282.         IF MY >= ABY AND MY <= ABY + 12 THEN
  283.  
  284.             IF TBA2(nr).D < TIMER THEN
  285.                 IF _PIXELSIZE = 4 THEN
  286.                     LINE (LUPAC, ABY)-(LUPAC + 12, ABY + 12), &H44FFFFFF, BF
  287.                 ELSE
  288.                     LINE (LUPAC, ABY)-(LUPAC + 12, ABY + 12), 14, B
  289.                 END IF
  290.                 IF MB1 THEN
  291.                     B = B + 1
  292.                     MB1 = 0
  293.                     TBA2(nr).D = TIMER + .01
  294.                 END IF
  295.             END IF
  296.         END IF
  297.     END IF
  298.  
  299.     'driving left arrow on bottom
  300.     IF MX >= X - 27 AND MX <= X - 15 THEN '12 + 15 = 27, 12 is arrow width
  301.         IF MY >= ABY + 1 AND MY <= ABY + 13 THEN
  302.             IF TBA2(nr).D < TIMER THEN
  303.                 IF _PIXELSIZE = 4 THEN
  304.                     LINE (X - 27, ABY + 1)-(X - 15, ABY + 13), &H44FFFFFF, BF
  305.                 ELSE
  306.  
  307.                     LINE (X - 27, ABY + 1)-(X - 15, ABY + 13), 14, B
  308.                 END IF
  309.                 IF MB1 THEN
  310.                     B = B - 1
  311.                     MB1 = 0
  312.                     TBA2(nr).D = TIMER + .01
  313.                 END IF
  314.             END IF
  315.         END IF
  316.     END IF
  317.  
  318.  
  319.     'new: left - right keyboard driving:       (home, end, pg up, pg dn, insert (not edit), delete (not edit), arrows up, down, left, right)
  320.     IF MX >= X - 30 AND MX <= X + BoxLenght * _FONTWIDTH + 30 THEN
  321.         IF MY > Y AND MY <= Y + BoxHeight THEN
  322.  
  323.             KH& = _KEYHIT
  324.             IF KH& THEN
  325.                 SELECT CASE KH&
  326.                     CASE 18176: B = 1
  327.                     CASE 20224: B = RowLen - TBA2(nr).L + 1
  328.                     CASE 18688: B = B - TBA2(nr).L ' PgUP
  329.                     CASE 20736: B = B + TBA2(nr).L ' PgDN
  330.                     CASE 19200: B = B - 1 '          left
  331.                     CASE 19712: B = B + 1 '          right
  332.                     CASE 18432: BH = BH - 1 '        up
  333.                     CASE 20480: BH = BH + 1 '         down
  334.                     CASE 20992: BH = BH + TBA2(nr).H 'insert
  335.                     CASE 21428: BH = BH - TBA2(nr).H 'delete
  336.                 END SELECT
  337.                 _KEYCLEAR
  338.             END IF
  339.  
  340.         END IF
  341.     END IF
  342.  
  343.     IF BH < TBA2(nr).I_s THEN BH = TBA2(nr).I_s
  344.     IF BH > TBA2(nr).I_e THEN BH = TBA2(nr).I_e
  345.  
  346.  
  347.     IF B > RowLen - TBA2(nr).L + 1 THEN B = RowLen - TBA2(nr).L + 1
  348.     IF B < 1 THEN B = 1
  349.  
  350.     TBA2(nr).B = B '      B is variable for shift left and right
  351.     TBA2(nr).BH = BH '    BH is variable for shift up and down
  352.  
  353.     IF _PIXELSIZE = 4 THEN COLOR &HFFFFFFFF ELSE COLOR 15
  354.  
  355.     IF TBA2(nr).filter = 0 THEN CString k(), nr: TBA2(nr).filter = 1 'and this is row, which AGAIN find me STRING BUG. Nr is not correct, if is STRING without star used!
  356.  
  357.  
  358.     BHE = BH + TBA2(nr).H - 2
  359.     IF BHE > TBA2(nr).I_e THEN BHE = TBA2(nr).I_e
  360.  
  361.  
  362.     'coloring and printing content
  363.  
  364.     FOR Rows = BH TO BHE
  365.         FOR v = 1 TO RowLen
  366.             FOR T = LBOUND(k) + 1 TO UBOUND(k)
  367.                 IF k(T).flag = nr THEN '               here is contained color bug. For better solution must be first found starting color, on which text start. It will be done later.
  368.                     IF Rows = k(T).row THEN
  369.                         IF v = k(T).onpos + 1 THEN COLOR k(T).clr: EXIT FOR
  370.                     END IF
  371.                 END IF
  372.             NEXT
  373.             IF v >= B AND v <= B + TBA2(nr).L THEN
  374.                 _PRINTSTRING (X - 20 + (w * _FONTWIDTH), Y + (Rows - BH) * _FONTHEIGHT), MID$(GlobalText(Rows), v, 1)
  375.                 w = w + 1
  376.             END IF
  377.         NEXT
  378.         w = 0
  379.     NEXT Rows
  380.  
  381.  
  382. FUNCTION PutArrow&
  383.     IF _PIXELSIZE = 4 THEN
  384.         PutArrow& = _NEWIMAGE(12, 12, 32)
  385.     ELSE
  386.         PutArrow& = _NEWIMAGE(12, 12, 256)
  387.     END IF
  388.  
  389.     D = _DEST
  390.     _DEST PutArrow&
  391.  
  392.     LINE (1, 4)-(6, 4)
  393.     LINE (1, 8)-(6, 8)
  394.     LINE (1, 4)-(1, 8)
  395.     LINE (6, 4)-(6, 1)
  396.     LINE (6, 8)-(6, 11)
  397.     LINE (6, 11)-(11, 6)
  398.     LINE (6, 1)-(11, 6)
  399.  
  400.     IF _PIXELSIZE(D) = 4 THEN PAINT (6, 6), &HFF777777, &HFFFFFFFF ELSE PAINT (6, 6), 10, 15
  401.     IF _PIXELSIZE(D) = 4 THEN _CLEARCOLOR &HFF000000, PutArrow& ELSE _CLEARCOLOR 0, PutArrow&
  402.     _DEST D
  403.  
  404.  
  405. SUB CString (K() AS Colored, index AS INTEGER)
  406.     FOR rows = TBA2(index).I_s TO TBA2(index).I_e
  407.         source$ = GlobalText(rows)
  408.         FOR S = 1 TO LEN(source$)
  409.             old$ = t$
  410.             t$ = MID$(source$, S, 1)
  411.             IF ASC(t$) >= 48 AND ASC(t$) <= 57 AND incolor THEN colornr$ = colornr$ + t$
  412.             IF incolor AND ASC(t$) < 48 OR incolor AND ASC(t$) > 57 THEN
  413.                 K(kk).clr = VAL(colornr$): D = D + LEN(colornr$): colornr$ = "": incolor = 0
  414.                 IF old$ = "/" THEN text$ = text$ + old$
  415.             END IF
  416.  
  417.             IF t$ = "/" THEN
  418.                 D = D + 1
  419.                 incolor = 1
  420.                 REDIM _PRESERVE K(UBOUND(k) + 1) AS Colored
  421.                 kk = UBOUND(k)
  422.                 K(kk).onpos = S - D
  423.                 K(kk).flag = index
  424.                 K(kk).row = rows
  425.             END IF
  426.             IF incolor = 0 THEN text$ = text$ + t$
  427.         NEXT
  428.  
  429.         GlobalText(rows) = text$
  430.         text$ = ""
  431.         ind = ind + 1
  432.         D = 0
  433.     NEXT rows
  434.  
  435.  
  436. SUB R90 (img0 AS LONG, img1 AS LONG, img2 AS LONG, img3 AS LONG) 'create 4 arrows from one in four directions
  437.     IF img0 >= -1 THEN EXIT SUB 'source image is invalid
  438.     W = _WIDTH(img0)
  439.     H = _HEIGHT(img0)
  440.     P = _PIXELSIZE(img0)
  441.     DIM CC AS _UNSIGNED LONG
  442.  
  443.     SELECT CASE P
  444.         CASE 0: EXIT SUB 'text mode unsupported
  445.         CASE 1: D = 256: CC = 0
  446.         CASE 4: D = 32: CC = &HFF000000
  447.     END SELECT
  448.  
  449.     img1 = _NEWIMAGE(W, H, D)
  450.     _PUTIMAGE , img0, img1, (W, 1)-(1, H) '180 degrees rotating
  451.  
  452.     img2 = _NEWIMAGE(H, W, D) '            90
  453.     _MAPTRIANGLE (0, 0)-(W, 0)-(W, H), img0 TO(H, 0)-(H, W)-(0, W), img2
  454.     _MAPTRIANGLE (0, 0)-(W, H)-(0, H), img0 TO(H, 0)-(0, W)-(0, 0), img2
  455.  
  456.     img3 = _NEWIMAGE(H, W, D)
  457.     _PUTIMAGE , img2, img3, (1, W)-(H, 1) '270
  458.     _CLEARCOLOR CC, img1
  459.     _CLEARCOLOR CC, img2
  460.     _CLEARCOLOR CC, img3
  461.  
  462. FUNCTION MaximalRowLenght (i)
  463.     MaximalRowLenght = 0
  464.     REDIM test(0) AS STRING
  465.     ClearColorRecordsAndVauesFromTextArray TBA2(i).I_s, TBA2(i).I_e, test()
  466.  
  467.     FOR p = LBOUND(test) TO UBOUND(test)
  468.         IF MaximalRowLenght < LEN(test(p)) THEN MaximalRowLenght = LEN(test(p))
  469.     NEXT
  470.  
  471. SUB ClearColorRecordsAndVauesFromTextArray (start, eend, arrname() AS STRING) 'If we need find maximal row lenght, first must color tags be deleted from text.
  472.     REDIM arrname(eend - start) AS STRING
  473.     FOR c = start TO eend
  474.         FOR L = 1 TO LEN(GlobalText(c))
  475.             ch$ = MID$(GlobalText(c), L, 1)
  476.             IF ch$ = "/" THEN iscolor = 1
  477.             IF iscolor AND ASC(ch$) > 47 AND ASC(ch$) < 58 THEN ELSE t$ = t$ + ch$
  478.             IF iscolor AND ASC(ch$) < 47 OR iscolor AND ASC(ch$) > 58 THEN
  479.                 iscolor = 0
  480.             END IF
  481.         NEXT
  482.         arrname(c - start) = t$
  483.         t$ = ""
  484.     NEXT c
  485.  
  486. 'End of future "TextBox.BM"
  487.  

  [ You are not allowed to view this attachment ]  

X - slider:

Also, this program does not have a limited number of sliders. You can place them as much as big is your RAM. This is the older version on which the X/Y new version is based.


Code: QB64: [Select]
  1. 'promise: Textbox with use as PRINT. NEED GRAPHIC SCREEN!
  2.  
  3. 'this is future "TextBox.BI"
  4. TYPE Colored
  5.     onpos AS INTEGER
  6.     clr AS _UNSIGNED LONG
  7.     flag AS INTEGER
  8. REDIM SHARED k(0) AS Colored
  9.  
  10. TYPE TB
  11.     X AS INTEGER '   X position graphic coord
  12.     Y AS INTEGER '   Y position graphic coord
  13.     L AS INTEGER '   TextBox lenght
  14.     T AS STRING '    TextBox text
  15.     B AS INTEGER '   Text begin in textbox  (for shift)
  16.     Arrow AS LONG
  17.     D AS SINGLE 'for time delay between click to arrows
  18. REDIM SHARED TBA(0) AS TB
  19. SCREEN _NEWIMAGE(800, 600, 256) 'screen must be initialized before PutArrow& is run.
  20.  
  21.  
  22. TBA(0).Arrow = PutArrow&
  23. 'real textboxes starting from 1
  24.  
  25. 'end of future "TextBox.BI"
  26.  
  27.  
  28. DIM test(10) AS LONG
  29.  
  30. FOR t = 1 TO 10
  31.     test(t) = INITBOX(100 + 25 * RND, 40 * t, "/42Hi World in 32 bites/29 colored long text/15 placed in textbox.", 15 + RND * 60)
  32. Demo = INITBOX(150, 500, "/49 Here /55is used /42absolutely random color /77number...", 29)
  33.  
  34.  
  35.  
  36.     FOR p = 1 TO 10
  37.         XY_BOX p
  38.     NEXT
  39.     XY_BOX Demo
  40.  
  41.     _DISPLAY
  42.  
  43. 'this is future "TextBox.BM"
  44.  
  45. FUNCTION INITBOX (X AS INTEGER, Y AS INTEGER, Text AS STRING, BoxLenght AS INTEGER) 'X, Y are GRAPHIC coordinates
  46.     UTB = UBOUND(tba)
  47.     REDIM _PRESERVE TBA(UTB + 1) AS TB
  48.     TBA(UTB + 1).X = X
  49.     TBA(UTB + 1).Y = Y
  50.     TBA(UTB + 1).L = BoxLenght
  51.     CString Text, text2$, k(), UTB + 1
  52.     TBA(UTB + 1).T = text2$
  53.     TBA(UTB + 1).B = 1
  54.     INITBOX = UTB + 1
  55.  
  56.  
  57. SUB XY_BOX (nr AS LONG)
  58.     IF nr < 1 OR nr > UBOUND(tba) THEN EXIT SUB 'subscript out of range prevention
  59.     '256/32 color support:
  60.         CASE 0: BEEP: PRINT "Text mode not supported by PRINTBOX!": _DISPLAY: SLEEP 3: END
  61.         CASE 1
  62.             Black~& = 0
  63.             White~& = 15
  64.             Grey~& = 24
  65.             Grey2~& = 19
  66.         CASE 4
  67.             Black~& = &HFF000000
  68.             White~& = &HFFFFFFFF
  69.             Grey~& = &HFF6666666
  70.             Grey2~& = &HFF221122
  71.     END SELECT
  72.  
  73.  
  74.  
  75.  
  76.     TextBoxArrow& = TBA(0).Arrow
  77.     TextLenght = _PRINTWIDTH(TBA(nr).T)
  78.     B = TBA(nr).B
  79.     TextHeight = _FONTHEIGHT
  80.     X = TBA(nr).X
  81.     Y = TBA(nr).Y
  82.     BoxLenght = TBA(nr).L
  83.     T$ = MID$(TBA(nr).T, TBA(nr).B, TBA(nr).L) 'text loader
  84.  
  85.  
  86.         mwh = mwh + _MOUSEWHEEL
  87.         IF mwh THEN EXIT WHILE
  88.     WEND
  89.  
  90.     IF _MOUSEX >= X - 30 AND _MOUSEX <= X + 30 + BoxLenght * _FONTWIDTH THEN
  91.         IF _MOUSEY >= Y - 3 AND _MOUSEY <= Y + 3 + 2 * TextHeight THEN
  92.             B = B + mwh * 4
  93.         END IF
  94.     END IF
  95.  
  96.  
  97.     '
  98.     MB1 = _MOUSEBUTTON(1)
  99.     MX = _MOUSEX
  100.     MY = _MOUSEY
  101.  
  102.     LINE (X - 30, Y - 3)-(X + 30 + BoxLenght * _FONTWIDTH, Y + TextHeight * 2), Black~&, BF
  103.  
  104.  
  105.     LINE (X - 30, Y + TextHeight)-(X + 30 + BoxLenght * _FONTWIDTH, Y + TextHeight * 2), Grey~&, BF
  106.     LINE (X - 30, Y - 3)-(X + 30 + BoxLenght * _FONTWIDTH, Y + 2 * TextHeight), White~&, B
  107.  
  108.     LINE (X - 28, Y - 1)-(X + 28 + BoxLenght * _FONTWIDTH, Y + TextHeight), White~&, B
  109.  
  110.     TL = B / LEN(TBA(nr).T) * 100 'pocatecni poloha pruhu v procentech       begining position for bottom box (perecentually)
  111.     L = TBA(nr).L * _FONTWIDTH
  112.     Actual = _CEIL(X + (TL / 100 * L)) '                                     graphic position for bottom box
  113.     boxl = BoxLenght * _FONTWIDTH
  114.     BL = boxl / (TextLenght / 100) 'delka posuvneho boxiku  v procentech     box on bottom lenght
  115.     IF BL > 100 THEN BL = 100
  116.  
  117.     BBL = boxl / 100 * BL
  118.  
  119.     'posuvnik                 Slider
  120.     LINE (Actual, Y + TextHeight + 5)-(Actual + BBL, Y + TextHeight * 2 - 3), White~&, BF
  121.     LINE (Actual, Y + TextHeight + 5)-(Actual + BBL, Y + TextHeight * 2 - 3), Grey2~&, B
  122.  
  123.  
  124.  
  125.     IF MX >= X AND MX <= X + _FONTWIDTH * TBA(nr).L THEN
  126.         IF MY >= Y + TextHeight + 5 AND MY <= Y + TextHeight * 2 - 3 THEN
  127.             IF MB1 THEN
  128.                 omx = MX
  129.                 DO UNTIL _MOUSEX <> MX
  130.                     WHILE _MOUSEINPUT: WEND
  131.                     MB1 = _MOUSEBUTTON(1)
  132.                     B = B + _MOUSEX - omx
  133.                 LOOP
  134.             END IF
  135.         END IF
  136.     END IF
  137.  
  138.  
  139.     _PUTIMAGE (X + 15 + BoxLenght * _FONTWIDTH, Y + TextHeight + 1), TextBoxArrow&
  140.     _PUTIMAGE (X - 15, Y + TextHeight + 1)-(X - 27, Y + TextHeight + 1 + 12), TextBoxArrow&
  141.  
  142.     IF TIMER < 1 THEN TBA(nr).D = 0
  143.  
  144.     IF MX >= X + 15 + BoxLenght * _FONTWIDTH AND MX <= X + 15 + BoxLenght * _FONTWIDTH + 12 THEN
  145.         IF MY >= Y + 1 + TextHeight AND MY <= Y + TextHeight * 2 THEN
  146.             IF TBA(nr).D < TIMER THEN
  147.                 IF _PIXELSIZE = 4 THEN
  148.                     LINE (X + 15 + BoxLenght * _FONTWIDTH, Y + TextHeight + 1)-(X + 15 + BoxLenght * _FONTWIDTH + 11, Y + TextHeight * 2), &H44FFFFFF, BF
  149.                 ELSE
  150.                     LINE (X + 15 + BoxLenght * _FONTWIDTH, Y + TextHeight + 1)-(X + 15 + BoxLenght * _FONTWIDTH + 11, Y + TextHeight * 2), 14, B
  151.                 END IF
  152.                 IF MB1 THEN
  153.                     B = B + 1
  154.                 END IF
  155.                 TBA(nr).D = TIMER + .01
  156.             END IF
  157.         END IF
  158.     END IF
  159.  
  160.     IF MX >= X - 26 AND MX <= X - 15 THEN
  161.         IF MY >= Y + 1 + TextHeight AND MY <= Y + TextHeight * 2 THEN
  162.  
  163.             SELECT CASE _KEYHIT
  164.                 CASE 18176: B = 1
  165.                 CASE 20224: B = LEN(TBA(nr).T) - TBA(nr).L + 1
  166.                 CASE 18688: B = B - TBA(nr).L
  167.                 CASE 20736: B = B + TBA(nr).L
  168.             END SELECT
  169.  
  170.  
  171.             IF TBA(nr).D < TIMER THEN
  172.                 IF _PIXELSIZE = 4 THEN
  173.                     LINE (X - 26, Y + TextHeight + 1)-(X - 15, Y + TextHeight * 2), &H44FFFFFF, BF
  174.                 ELSE
  175.                     LINE (X - 26, Y + TextHeight + 1)-(X - 15, Y + TextHeight * 2), 14, B
  176.                 END IF
  177.                 IF MB1 THEN
  178.                     B = B - 1
  179.                 END IF
  180.                 TBA(nr).D = TIMER + .01
  181.             END IF
  182.         END IF
  183.     END IF
  184.  
  185.     IF B > LEN(TBA(nr).T) - TBA(nr).L + 1 THEN B = LEN(TBA(nr).T) - TBA(nr).L + 1
  186.     IF B < 1 THEN B = 1
  187.     TBA(nr).B = B
  188.  
  189.     IF _PIXELSIZE = 4 THEN COLOR &HFFFFFFFF ELSE COLOR 15
  190.  
  191.  
  192.     FOR V = 1 TO LEN(TBA(nr).T)
  193.         FOR t = LBOUND(k) + 1 TO UBOUND(k)
  194.             IF k(t).flag = nr THEN
  195.                 IF V = k(t).onpos + 1 THEN COLOR k(t).clr: EXIT FOR
  196.             END IF
  197.         NEXT
  198.  
  199.         IF V >= B AND V <= B + TBA(nr).L THEN
  200.             _PRINTSTRING (X + (W * _FONTWIDTH), Y), MID$(TBA(nr).T, V, 1)
  201.             W = W + 1
  202.         END IF
  203.     NEXT
  204.  
  205.  
  206.  
  207. FUNCTION PutArrow&
  208.     IF _PIXELSIZE = 4 THEN
  209.         PutArrow& = _NEWIMAGE(12, 12, 32)
  210.     ELSE
  211.         PutArrow& = _NEWIMAGE(12, 12, 256)
  212.     END IF
  213.  
  214.     D = _DEST
  215.     _DEST PutArrow&
  216.  
  217.     LINE (1, 4)-(6, 4) '  ------------     up
  218.     LINE (1, 8)-(6, 8) '  ------------     down
  219.     LINE (1, 4)-(1, 8) '  I                arrow back
  220.     LINE (6, 4)-(6, 1)
  221.     LINE (6, 8)-(6, 11)
  222.     LINE (6, 11)-(11, 6)
  223.     LINE (6, 1)-(11, 6)
  224.  
  225.     IF _PIXELSIZE(D) = 4 THEN PAINT (6, 6), &HFF777777, &HFFFFFFFF ELSE PAINT (6, 6), 10, 15
  226.     IF _PIXELSIZE(D) = 4 THEN _CLEARCOLOR &HFF000000, PutArrow& ELSE _CLEARCOLOR 0, PutArrow&
  227.     _DEST D
  228.  
  229. SUB CString (source AS STRING, text AS STRING, K() AS Colored, index AS INTEGER)
  230.     FOR S = 1 TO LEN(source$)
  231.         t$ = MID$(source$, S, 1)
  232.         IF ASC(t$) >= 48 AND ASC(t$) <= 57 AND incolor THEN colornr$ = colornr$ + t$
  233.         IF incolor AND ASC(t$) < 48 OR incolor AND ASC(t$) > 57 THEN K(kk).clr = VAL(colornr$): D = D + LEN(colornr$): colornr$ = "": incolor = 0
  234.         IF t$ = "/" THEN
  235.             D = D + 1
  236.             incolor = 1
  237.             REDIM _PRESERVE K(UBOUND(k) + 1) AS Colored
  238.             kk = UBOUND(k)
  239.             K(kk).onpos = S - D
  240.             K(kk).flag = index
  241.         END IF
  242.         IF incolor = 0 THEN text$ = text$ + t$
  243.     NEXT
  244.  
  245. 'End of future "TextBox.BM"
  246.  

  [ You are not allowed to view this attachment ]  

There are two known flies. One - the slider position calculation is not entirely accurate. I really don't want to deal with it. Second - if the color definition starts outside the displayed part in the X / Y slider, it is displayed in white. This is what I want to solve, and I'll solve it sometime.... not today.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Scroll Bar
« Reply #62 on: September 30, 2019, 05:10:29 pm »
waiting news...
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Scroll Bar
« Reply #63 on: October 01, 2019, 06:58:17 pm »
Congrats Petr!

I just have worked out all the bugs in mine. I use the whole box as a 2D scroll bar with mouse clicks or down and drag.
Like in my hScroller, I use indicator bars around the box to show the location of text left and right and top to bottom.

I will post code later when I get more than 2D text boxes going.

PS 317 lines so far ;-))

« Last Edit: October 01, 2019, 07:02:14 pm by bplus »

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Scroll Bar
« Reply #64 on: October 01, 2019, 08:39:18 pm »
Well it seems that here we'll have 3 good tool for textbox with scrolling both as single line both as multiline!
Great work
Programming isn't difficult, only it's  consuming time and coffee

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Scroll Bar
« Reply #65 on: October 02, 2019, 08:04:52 am »
Quote
BPlus wrote:

I will post code later when I get more than 2D text boxes going.

  [ You are not allowed to view this attachment ]  

Quote
PS 317 lines so far ;-))

Yes, without coloring text ;)

TempodiBasic wrote:

Quote
waiting news...
Which?

The color correction (bug repair), about which write on top, is done. I will release another fix as soon as it is time to put it into the program :)

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Scroll Bar
« Reply #66 on: October 02, 2019, 08:22:23 am »
BPlus, there are many options that lead to huge programs with complexity. For example. Someone already solved it but not in the textbox - text and image insertion. This can be done by adding another command (so as is "/") to the text loop. Maybe I'll try. If I am now using the tag / for the color command, I add another one, with the width, height, and name of the image, and then the position of the image in the textbox must follow. This is an example. Or - something lighter - a tag to set the color and transparency of the window background. It kind of starts to remind me of HTML ...

But still. First, I fix the current bugs, only then, maybe I'll try more.


Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Scroll Bar
« Reply #67 on: October 02, 2019, 08:46:03 am »
Quote
Yes, without coloring text ;)

I am coloring only the Box in focus, using Tab or Shift + Tab or Mouse over to change Box in focus for mouse or key input.

In screen shot you can see another box in focus, lit up Green background light Blue fore.
  [ You are not allowed to view this attachment ]  

Dang! another bug!
« Last Edit: October 02, 2019, 09:01:49 am by bplus »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Scroll Bar
« Reply #68 on: October 02, 2019, 09:02:41 am »
Beautiful 3d screenshot bplus. I pulled this off once and posted at *.not, but the community was, um, not interested. Let's hope you catch more attention!
« Last Edit: October 02, 2019, 09:04:00 am by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Scroll Bar
« Reply #69 on: October 02, 2019, 09:14:13 am »
Beautiful 3d screenshot bplus. I pulled this off once and posted at *.not, but the community was, um, not interested. Let's hope you catch more attention!

Hi STxAxTIC,

Not sure if you mean the little text indicator bars of my screen shot or Petr's screen shot of "swinging door open" like screen, an effect I like very much. :)

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Scroll Bar
« Reply #70 on: October 02, 2019, 09:24:38 am »
Well I see news coming often in this thread!
Great job boys!
Programming isn't difficult, only it's  consuming time and coffee

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Scroll Bar
« Reply #71 on: October 03, 2019, 10:21:25 am »
Oh oops thats what I get for doing this while driving. Yes, the scrollbars are mad awesome. I admit I scrolled too fast and saw it was Petr that cranked out the tilted screenshot. Nice work both of you though. It's better than mine looked like, and Galleon even complemented it. He'd be even more impressed by you guys.
You're not done when it works, you're done when it's right.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Scroll Bar
« Reply #72 on: October 04, 2019, 01:36:29 pm »
Hi. Yeah, 3D... i create also one for you, current version works but from keyboard only, that is not enought. I add 3D version here later (in better graphic).

 This next here is 2D, which can be placed really in many copyes to screen, contains color bug repair.

1980x1050 on screen resolution recommended.

Code: QB64: [Select]
  1.  
  2.  
  3. 'this is future "TextBox.BI"
  4. TYPE Colored '                      This Array contains colors positions on text and color values. This array is created in SUB CString.
  5.     onpos AS INTEGER
  6.     clr AS _UNSIGNED LONG
  7.     flag AS INTEGER
  8.     row AS INTEGER
  9. REDIM SHARED k(0) AS Colored
  10.  
  11. TYPE TB2
  12.     X AS INTEGER '   X position graphic coord
  13.     Y AS INTEGER '   Y position graphic coord
  14.     L AS INTEGER '   TextBox lenght
  15.     H AS INTEGER '   Textbox HEIGHT                                            NEW
  16.     T AS STRING * 1 '    TextBox text
  17.     B AS INTEGER '   Text begin in textbox  (for shift), X axis
  18.     BH AS INTEGER '  Text begin in textbox  (for shift), Y axis                NEW
  19.  
  20.     D AS SINGLE '    for time delay between click to arrows
  21.     I_s AS INTEGER
  22.     I_e AS INTEGER
  23.     filter AS _BYTE 'new info flag for CString, which is needed just in the start, but not more.
  24.     init AS _BYTE
  25.  
  26. REDIM SHARED TBA2(0) AS TB2
  27. REDIM SHARED GlobalText(0) AS STRING 'spolecne obrovske textove pole obsahujici texty pro vsechna okna vcetne udaju o barvach
  28. DIM SHARED Arrow0 AS LONG, Arrow1 AS LONG, Arrow2 AS LONG, Arrow3 AS LONG
  29.  
  30.  
  31. SCREEN _NEWIMAGE(1980, 1050, 256) 'screen must be initialized before PutArrow& is run.
  32. Arrow0 = PutArrow
  33. R90 Arrow0, Arrow1, Arrow2, Arrow3 'create four arrows in four directions from first source image
  34. 'end of future "TextBox.BI"
  35.  
  36.  
  37.  
  38.  
  39. DIM Text1(7) AS STRING
  40. DIM Text2(14) AS STRING
  41.  
  42. Text1(1) = "/14This is content /1for /2array /3Text1. Original and source text array content is in"
  43. Text1(2) = "/44array Text1. Because Petr can just 2 ways (first: MEM Pointer to array insert"
  44. Text1(3) = "/45to type), or second, easyest - all texts insert to one STRING SHARED array, and"
  45. Text1(4) = "/46writing informations about start and end index to TYPE, is now this text also"
  46. Text1(5) = "/47inserted to array named as GlobalText. Because this text contains 7 rows and "
  47. Text1(6) = "/48Text1 array is inserted as first, is this saved in indexes 0 to 6 in array"
  48. Text1(7) = "/49GlobalText. Info about this records are here saved to TBA2().I_s and TBA2().I_e"
  49.  
  50.  
  51.  
  52. Text2(1) = "                /14   Example for use:"
  53. Text2(2) = "/45With /40'/90/'/40 /45and then number you set colors. If you use _SCREEN _NEWIMAGE in 256 colors,"
  54. Text2(3) = "then use number from 0 to 256. But if you use 32 bit screen, then dont use &H values but"
  55. Text2(4) = "/50 number. This number can be returned using this easy source code:"
  56. Text2(5) = "/55 COLOR~& = &HFFFFFFFF  /60 or /55 COLOR~& = _RGBA32(255, 255, 255)"
  57. Text2(6) = "PRINT COLOR~&. /60 This is number, which you need for use to 32 bit screens with this"
  58. Text2(7) = "easy program. (i write soon automatic translator for it, but with my time....)/9"
  59. Text2(8) = "Program construction: - All strings are saved to array /14 GlobalText."
  60. Text2(9) = "                     /9 - Function /14R90/9 create 4 images which contains rows, rotated from 1"
  61. Text2(10) = "                       source image, which is created with Function /14PutArrow./9"
  62. Text2(11) = "                     - /14CString /9SUB create help array for colors used in text to array /14K/9."
  63. Text2(12) = "                     - /14MaximalRowLenght/9 Function return lenght of longest row in text array."
  64. Text2(13) = "                     - Function /14INITBOX2/9 write all needed records to program arrays and return record number."
  65. Text2(14) = "                     - /14XY_BOX /9SUB - own program. Study it /33yourself /40:-)"
  66.  
  67.  
  68.  
  69. DIM boxes(35)
  70.  
  71. FOR B1 = 1 TO 10
  72.     boxes(B1) = INITBOX2(-158 + 198 * B1, 50, Text1(), 17, 10)
  73.  
  74. FOR B1 = 11 TO 20
  75.     boxes(B1) = INITBOX2(-158 + 198 * (-10 + B1), 250, Text2(), 17, 10)
  76.  
  77. FOR B1 = 21 TO 30
  78.     boxes(B1) = INITBOX2(-158 + 198 * (-20 + B1), 450, Text1(), 17, 15)
  79.  
  80. co = 40
  81. FOR B1 = 31 TO 35
  82.     boxes(B1) = INITBOX2(co, 700, Text2(), 35, 20)
  83.     co = co + 400
  84.  
  85.  
  86.  
  87.  
  88.     FOR B1 = 1 TO 10
  89.         XY_BOX boxes(B1)
  90.     NEXT
  91.  
  92.     FOR B1 = 11 TO 20
  93.         XY_BOX boxes(B1)
  94.     NEXT
  95.  
  96.     FOR B1 = 21 TO 30
  97.         XY_BOX boxes(B1)
  98.     NEXT
  99.  
  100.     FOR B1 = 31 TO 35
  101.         XY_BOX boxes(B1)
  102.     NEXT
  103.  
  104.     _DISPLAY
  105.     _LIMIT 60
  106.  
  107.  
  108.  
  109. 'this is future "TextBox.BM"
  110. FUNCTION INITBOX2 (X AS INTEGER, Y AS INTEGER, Text() AS STRING, BoxLenght AS INTEGER, BoxHeight AS INTEGER) 'X, Y are GRAPHIC coordinates
  111.     UTB = UBOUND(tba2)
  112.     REDIM _PRESERVE TBA2(UTB + 1) AS TB2
  113.     TBA2(UTB + 1).X = X
  114.     TBA2(UTB + 1).Y = Y
  115.     TBA2(UTB + 1).L = BoxLenght
  116.     TBA2(UTB + 1).H = BoxHeight
  117.  
  118.  
  119.  
  120.  
  121.     TBA2(UTB + 1).T = ""
  122.     U1 = UBOUND(globaltext)
  123.     U2 = UBOUND(text)
  124.  
  125.     TBA2(UTB + 1).I_s = U1
  126.     TBA2(UTB + 1).I_e = U1 + U2
  127.  
  128.     REDIM _PRESERVE GlobalText(U1 + U2 + 1) AS STRING
  129.  
  130.     FOR insert = U1 TO U1 + U2
  131.         GlobalText(insert) = Text(t)
  132.         t = t + 1
  133.     NEXT
  134.  
  135.     TBA2(UTB + 1).BH = U1 + 1 'after first start: first row (BH is shift in Y, B is shift in X axis)
  136.     TBA2(UTB + 1).B = 1 'and first column
  137.     INITBOX2 = UTB + 1
  138.  
  139.  
  140. SUB XY_BOX (nr AS LONG)
  141.  
  142.  
  143.         mwh = mwh + _MOUSEWHEEL
  144.         IF mwh THEN EXIT WHILE
  145.     WEND
  146.  
  147.  
  148.     '
  149.     MB1 = _MOUSEBUTTON(1)
  150.     MX = _MOUSEX
  151.     MY = _MOUSEY
  152.     RowLen = MaximalRowLenght(nr)
  153.     TextLenght = RowLen * _FONTWIDTH
  154.     B = TBA2(nr).B
  155.     BH = TBA2(nr).BH
  156.  
  157.     TextHeight = _FONTHEIGHT
  158.     X = TBA2(nr).X
  159.     Y = TBA2(nr).Y
  160.     BoxLenght = TBA2(nr).L - 2
  161.     BoxHeight = 1 + TBA2(nr).H * _FONTHEIGHT
  162.     Init = TBA2(nr).init
  163.  
  164.  
  165.     IF MX >= X - 30 AND MX <= X + 30 + (BoxLenght + 2) * _FONTWIDTH THEN
  166.         IF MY >= Y - 30 AND MY <= Y + BoxHeight THEN
  167.             onpos = 1
  168.         END IF
  169.     END IF
  170.  
  171.     IF Init = 0 OR onpos THEN
  172.  
  173.  
  174.  
  175.         '256/32 color support:
  176.  
  177.         SELECT CASE _PIXELSIZE
  178.             CASE 0: BEEP: PRINT "Text mode not supported by PRINTBOX!": _DISPLAY: SLEEP 3: END
  179.             CASE 1
  180.                 Black~& = 0
  181.                 White~& = 15
  182.                 Grey~& = 24
  183.                 Grey2~& = 19
  184.             CASE 4
  185.                 Black~& = &HFF000000
  186.                 White~& = &HFFFFFFFF
  187.                 Grey~& = &H226666666
  188.                 Grey2~& = &HFF221122
  189.         END SELECT
  190.  
  191.  
  192.         RowLen = MaximalRowLenght(nr)
  193.         TextLenght = RowLen * _FONTWIDTH
  194.         B = TBA2(nr).B
  195.         BH = TBA2(nr).BH
  196.  
  197.         TextHeight = _FONTHEIGHT
  198.         X = TBA2(nr).X
  199.         Y = TBA2(nr).Y
  200.         BoxLenght = TBA2(nr).L - 2
  201.         BoxHeight = 1 + TBA2(nr).H * _FONTHEIGHT
  202.  
  203.         '        WHILE _MOUSEINPUT:
  204.         '        mwh = mwh + _MOUSEWHEEL
  205.         '            IF mwh THEN EXIT WHILE
  206.         '        WEND
  207.  
  208.         '        IF _MOUSEX >= X - 30 AND _MOUSEX <= X + 30 + BoxLenght * _FONTWIDTH THEN
  209.         '        IF _MOUSEY >= Y - 3 AND _MOUSEY <= Y + 3 + 2 * TextHeight THEN
  210.         '        B = B + mwh * 4
  211.         '    END IF
  212.         '    END IF
  213.  
  214.  
  215.         '
  216.         '       MB1 = _MOUSEBUTTON(1)
  217.         '       MX = _MOUSEX
  218.         '       MY = _MOUSEY
  219.  
  220.  
  221.  
  222.  
  223.         LINE (X - 30, Y)-(X + 30 + BoxLenght * _FONTWIDTH, Y + BoxHeight), Grey~&, BF 'vnitrek okna                                   window inside
  224.         LINE (X - 30, Y - 3)-(X + 30 + BoxLenght * _FONTWIDTH, Y + BoxHeight), White~&, B
  225.         LINE (X - 28, Y - 1)-(X + 28 + BoxLenght * _FONTWIDTH, Y + BoxHeight - TextHeight), White~&, B
  226.  
  227.         'borders for lines up / down
  228.         LINE (X + 30 + BoxLenght * _FONTWIDTH, Y - 1)-(X + 11 + BoxLenght * _FONTWIDTH, Y + BoxHeight - TextHeight), White~&, B
  229.  
  230.  
  231.         '  slider X calculations. For calculating slider lenght you need the number of characters of the longest sentence used in the box. MaximalRowLenght function return it:
  232.         '////////////////////////////////////////////////////////
  233.         TL = B / RowLen * 100 'pocatecni poloha pruhu v procentech            begining position for bottom box (percentually)
  234.         L = TBA2(nr).L * _FONTWIDTH 'celkova delka pruhu v pixelech           total slide lenght in pixels
  235.         Actual = _CEIL(X + (TL / 100 * L)) '                                  graphic position for bottom box
  236.         boxl = BoxLenght * _FONTWIDTH
  237.         BL = boxl / (TextLenght / 100) 'delka posuvneho boxiku  v procentech     box on bottom lenght  (how it is done: Slider lenght is percentually size as window bottom (for X - Shift).
  238.         '                                                                        if 30 percent of the sentence length is visible in the window, then the slider is 30 percent of the length of the X-side this window
  239.         IF BL > 100 THEN BL = 100 '                                              if text lenght < window X side, draw slider as 100 percent of X window side
  240.  
  241.         BBL = boxl / 100 * BL
  242.  
  243.         'posuvnik X        Slider X
  244.         LINE (Actual, Y + BoxHeight - TextHeight + 5)-(Actual + BBL, Y + BoxHeight - TextHeight + 12), White~&, BF
  245.         LINE (Actual, Y + BoxHeight - TextHeight + 5)-(Actual + BBL, Y + BoxHeight - TextHeight + 12), Grey2~&, B
  246.         '////////////////////////////////////////////////////////////
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.         'slider Y (the same os for X slider)
  254.         DelkaSteny = BoxHeight - TextHeight - (2 * _FONTHEIGHT) - 2
  255.         ZaznamuNaStenu = DelkaSteny / _FONTHEIGHT
  256.         Zaznamu100 = ZaznamuNaStenu / (TBA2(nr).I_e - TBA2(nr).I_s) * 100
  257.         BBH = (Zaznamu100 / 100) * DelkaSteny
  258.         IF BBH > DelkaSteny THEN BBH = DelkaSteny
  259.  
  260.         Pozice = 1 + (BH - TBA2(nr).I_e) / TBA2(nr).I_e
  261.         actualH = Y + _FONTHEIGHT + ((DelkaSteny - BBH) * Pozice)
  262.  
  263.  
  264.         'posuvnik Y        Slider Y
  265.         LINE (TBA2(nr).X + TBA2(nr).L * _FONTWIDTH, actualH)-(TBA2(nr).X + TBA2(nr).L * _FONTWIDTH + 7, actualH + BBH), White~&, BF
  266.         LINE (TBA2(nr).X + TBA2(nr).L * _FONTWIDTH, actualH)-(TBA2(nr).X + TBA2(nr).L * _FONTWIDTH + 7, actualH + BBH), Grey2~&, B
  267.  
  268.  
  269.  
  270.         ' solution for moving text by click + move to down box
  271.         IF MX >= X AND MX <= X + _FONTWIDTH * (TBA2(nr).L - 2) THEN
  272.             IF MY >= Y + BoxHeight - TextHeight AND MY <= Y + BoxHeight THEN
  273.                 IF MB1 THEN
  274.                     omx = MX
  275.                     DO UNTIL _MOUSEX <> MX
  276.                         WHILE _MOUSEINPUT: WEND
  277.                         MB1 = _MOUSEBUTTON(1)
  278.                         B = B + _MOUSEX - omx
  279.                     LOOP
  280.                 END IF
  281.             END IF
  282.         END IF
  283.  
  284.         ' solution for moving text up and down by clicking and move to box on right
  285.         IF MX >= X + 10 + BoxLenght * _FONTWIDTH AND MX <= X + 30 + BoxLenght * _FONTWIDTH THEN
  286.             IF MY >= Y + 16 AND MY <= Y + BoxHeight - 40 THEN
  287.                 IF MB1 THEN
  288.                     omy = MY
  289.                     DO UNTIL _MOUSEY <> MY
  290.                         WHILE _MOUSEINPUT: WEND
  291.                         MB1 = _MOUSEBUTTON(1)
  292.                         BH = BH + _MOUSEY - omy
  293.                     LOOP
  294.                 END IF
  295.             END IF
  296.         END IF
  297.  
  298.         ABY = Y + 2 + BoxHeight - TextHeight '                  ArrowBottomY coordinate
  299.         LUPAC = X + 15 + BoxLenght * _FONTWIDTH '               Left UP/Down Arrow coordinate
  300.  
  301.         _PUTIMAGE (LUPAC, ABY), Arrow0& '                              Arrow to right
  302.         _PUTIMAGE (X - 27, ABY + 1), Arrow1& '                                  left
  303.         _PUTIMAGE (LUPAC, Y + 2), Arrow3& '                                     up
  304.         _PUTIMAGE (LUPAC - 1, Y + TextHeight * (TBA2(nr).H - 2)), Arrow2& '     down
  305.  
  306.         IF TIMER < 1 THEN TBA2(nr).D = 0
  307.  
  308.         'driving up arrow
  309.         IF MX >= LUPAC AND MX <= LUPAC + 12 THEN
  310.             IF MY >= Y + 2 AND MY <= Y + 14 THEN
  311.                 IF TBA2(nr).D < TIMER THEN
  312.                     IF _PIXELSIZE = 4 THEN
  313.                         LINE (LUPAC, Y + 2)-(LUPAC + 12, Y + 14), &H44FFFFFF, BF
  314.                     ELSE
  315.                         LINE (LUPAC, Y + 2)-(LUPAC + 12, Y + 14), 14, B
  316.                     END IF
  317.                     IF MB1 THEN BH = BH - 1
  318.                     TBA2(nr).D = TIMER + .01
  319.                     MB1 = 0
  320.                 END IF
  321.             END IF
  322.         END IF
  323.  
  324.         'driving down arrow
  325.         IF MX >= LUPAC - 1 AND MX <= LUPAC + 11 THEN
  326.             IF MY >= Y + TextHeight * (TBA2(nr).H - 2) AND MY <= 12 + Y + TextHeight * (TBA2(nr).H - 2) THEN
  327.                 IF TBA2(nr).D < TIMER THEN
  328.                     IF _PIXELSIZE = 4 THEN
  329.                         LINE (LUPAC - 1, Y + TextHeight * (TBA2(nr).H - 2))-(LUPAC + 11, 12 + Y + TextHeight * (TBA2(nr).H - 2)), &H44FFFFFF, BF
  330.                     ELSE
  331.                         LINE (LUPAC - 1, Y + TextHeight * (TBA2(nr).H - 2))-(LUPAC + 11, 12 + Y + TextHeight * (TBA2(nr).H - 2)), 14, B
  332.                     END IF
  333.                     IF MB1 THEN BH = BH + 1
  334.                     TBA2(nr).D = TIMER + .01
  335.                     MB1 = 0
  336.                 END IF
  337.             END IF
  338.         END IF
  339.  
  340.  
  341.  
  342.         'driving right arrow on bottom
  343.         IF MX >= LUPAC AND MX <= LUPAC + 12 THEN
  344.             IF MY >= ABY AND MY <= ABY + 12 THEN
  345.  
  346.                 IF TBA2(nr).D < TIMER THEN
  347.                     IF _PIXELSIZE = 4 THEN
  348.                         LINE (LUPAC, ABY)-(LUPAC + 12, ABY + 12), &H44FFFFFF, BF
  349.                     ELSE
  350.                         LINE (LUPAC, ABY)-(LUPAC + 12, ABY + 12), 14, B
  351.                     END IF
  352.                     IF MB1 THEN
  353.                         B = B + 1
  354.                         MB1 = 0
  355.                         TBA2(nr).D = TIMER + .01
  356.                     END IF
  357.                 END IF
  358.             END IF
  359.         END IF
  360.  
  361.         'driving left arrow on bottom
  362.         IF MX >= X - 27 AND MX <= X - 15 THEN '12 + 15 = 27, 12 is arrow width
  363.             IF MY >= ABY + 1 AND MY <= ABY + 13 THEN
  364.                 IF TBA2(nr).D < TIMER THEN
  365.                     IF _PIXELSIZE = 4 THEN
  366.                         LINE (X - 27, ABY + 1)-(X - 15, ABY + 13), &H44FFFFFF, BF
  367.                     ELSE
  368.  
  369.                         LINE (X - 27, ABY + 1)-(X - 15, ABY + 13), 14, B
  370.                     END IF
  371.                     IF MB1 THEN
  372.                         B = B - 1
  373.                         MB1 = 0
  374.                         TBA2(nr).D = TIMER + .01
  375.                     END IF
  376.                 END IF
  377.             END IF
  378.         END IF
  379.  
  380.  
  381.         'new: left - right keyboard driving:       (home, end, pg up, pg dn, insert (not edit), delete (not edit), arrows up, down, left, right)
  382.         IF MX >= X - 30 AND MX <= X + BoxLenght * _FONTWIDTH + 30 THEN
  383.             IF MY > Y AND MY <= Y + BoxHeight THEN
  384.  
  385.                 KH& = _KEYHIT
  386.                 IF KH& THEN
  387.                     SELECT CASE KH&
  388.                         CASE 18176: B = 1
  389.                         CASE 20224: B = RowLen - TBA2(nr).L + 1
  390.                         CASE 18688: B = B - TBA2(nr).L ' PgUP
  391.                         CASE 20736: B = B + TBA2(nr).L ' PgDN
  392.                         CASE 19200: B = B - 1 '          left
  393.                         CASE 19712: B = B + 1 '          right
  394.                         CASE 18432: BH = BH - 1 '        up
  395.                         CASE 20480: BH = BH + 1 '         down
  396.                         CASE 20992: BH = BH + TBA2(nr).H 'insert
  397.                         CASE 21428: BH = BH - TBA2(nr).H 'delete
  398.                     END SELECT
  399.                     _KEYCLEAR
  400.                 END IF
  401.  
  402.             END IF
  403.         END IF
  404.  
  405.         IF BH < TBA2(nr).I_s THEN BH = TBA2(nr).I_s
  406.         IF BH > TBA2(nr).I_e THEN BH = TBA2(nr).I_e
  407.  
  408.  
  409.         IF B > RowLen - TBA2(nr).L + 1 THEN B = RowLen - TBA2(nr).L + 1
  410.         IF B < 1 THEN B = 1
  411.  
  412.         TBA2(nr).B = B '      B is variable for shift left and right
  413.         TBA2(nr).BH = BH '    BH is variable for shift up and down
  414.  
  415.         IF _PIXELSIZE = 4 THEN COLOR &HFFFFFFFF ELSE COLOR 15
  416.  
  417.         IF TBA2(nr).filter = 0 THEN CString k(), nr: TBA2(nr).filter = 1 'and this is row, which AGAIN find me STRING BUG. Nr is not correct, if is STRING without star used!
  418.  
  419.  
  420.         BHE = BH + TBA2(nr).H - 2
  421.         IF BHE > TBA2(nr).I_e THEN BHE = TBA2(nr).I_e
  422.  
  423.  
  424.         'coloring and printing content
  425.  
  426.  
  427.         'first line invalid color bug repair
  428.         FOR t = LBOUND(k) + 1 TO UBOUND(k)
  429.             IF k(t).flag = nr THEN
  430.                 IF k(t).row < BH THEN kkk~& = k(t).clr
  431.             END IF
  432.         NEXT
  433.         COLOR kkk~&
  434.  
  435.  
  436.  
  437.         FOR Rows = BH TO BHE
  438.             FOR v = 1 TO RowLen
  439.                 FOR t = LBOUND(k) + 1 TO UBOUND(k)
  440.                     IF k(t).flag = nr THEN '               here is repaired color bug.
  441.                         IF Rows = k(t).row THEN
  442.                             IF v = k(t).onpos + 1 THEN COLOR k(t).clr: EXIT FOR
  443.                         END IF
  444.                     END IF
  445.                 NEXT
  446.                 IF v >= B AND v <= B + TBA2(nr).L THEN
  447.                     _PRINTSTRING (X - 20 + (w * _FONTWIDTH), Y + (Rows - BH) * _FONTHEIGHT), MID$(GlobalText(Rows), v, 1)
  448.                     w = w + 1
  449.                 END IF
  450.             NEXT
  451.             w = 0
  452.         NEXT Rows
  453.  
  454.  
  455.         TBA2(nr).init = 1
  456.     END IF
  457.  
  458.  
  459.  
  460.  
  461.  
  462. FUNCTION PutArrow&
  463.     IF _PIXELSIZE = 4 THEN
  464.         PutArrow& = _NEWIMAGE(12, 12, 32)
  465.     ELSE
  466.         PutArrow& = _NEWIMAGE(12, 12, 256)
  467.     END IF
  468.  
  469.     D = _DEST
  470.     _DEST PutArrow&
  471.  
  472.     LINE (1, 4)-(6, 4)
  473.     LINE (1, 8)-(6, 8)
  474.     LINE (1, 4)-(1, 8)
  475.     LINE (6, 4)-(6, 1)
  476.     LINE (6, 8)-(6, 11)
  477.     LINE (6, 11)-(11, 6)
  478.     LINE (6, 1)-(11, 6)
  479.  
  480.     IF _PIXELSIZE(D) = 4 THEN PAINT (6, 6), &HFF777777, &HFFFFFFFF ELSE PAINT (6, 6), 10, 15
  481.     IF _PIXELSIZE(D) = 4 THEN _CLEARCOLOR &HFF000000, PutArrow& ELSE _CLEARCOLOR 0, PutArrow&
  482.     _DEST D
  483.  
  484.  
  485. SUB CString (K() AS Colored, index AS INTEGER)
  486.     FOR rows = TBA2(index).I_s TO TBA2(index).I_e
  487.         source$ = GlobalText(rows)
  488.         FOR S = 1 TO LEN(source$)
  489.             old$ = t$
  490.             t$ = MID$(source$, S, 1)
  491.             IF ASC(t$) >= 48 AND ASC(t$) <= 57 AND incolor THEN colornr$ = colornr$ + t$
  492.             IF incolor AND ASC(t$) < 48 OR incolor AND ASC(t$) > 57 THEN
  493.                 K(kk).clr = VAL(colornr$): D = D + LEN(colornr$): colornr$ = "": incolor = 0
  494.                 IF old$ = "/" THEN text$ = text$ + old$
  495.             END IF
  496.  
  497.             IF t$ = "/" THEN
  498.                 D = D + 1
  499.                 incolor = 1
  500.                 REDIM _PRESERVE K(UBOUND(k) + 1) AS Colored
  501.                 kk = UBOUND(k)
  502.                 K(kk).onpos = S - D
  503.                 K(kk).flag = index
  504.                 K(kk).row = rows
  505.             END IF
  506.             IF incolor = 0 THEN text$ = text$ + t$
  507.         NEXT
  508.  
  509.         GlobalText(rows) = text$
  510.         text$ = ""
  511.         ind = ind + 1
  512.         D = 0
  513.     NEXT rows
  514.  
  515.  
  516. SUB R90 (img0 AS LONG, img1 AS LONG, img2 AS LONG, img3 AS LONG) 'create 4 arrows from one in four directions
  517.     IF img0 >= -1 THEN EXIT SUB 'source image is invalid
  518.     W = _WIDTH(img0)
  519.     H = _HEIGHT(img0)
  520.     P = _PIXELSIZE(img0)
  521.     DIM CC AS _UNSIGNED LONG
  522.  
  523.     SELECT CASE P
  524.         CASE 0: EXIT SUB 'text mode unsupported
  525.         CASE 1: D = 256: CC = 0
  526.         CASE 4: D = 32: CC = &HFF000000
  527.     END SELECT
  528.  
  529.     img1 = _NEWIMAGE(W, H, D)
  530.     _PUTIMAGE , img0, img1, (W, 1)-(1, H) '180 degrees rotating
  531.  
  532.     img2 = _NEWIMAGE(H, W, D) '            90
  533.     _MAPTRIANGLE (0, 0)-(W, 0)-(W, H), img0 TO(H, 0)-(H, W)-(0, W), img2
  534.     _MAPTRIANGLE (0, 0)-(W, H)-(0, H), img0 TO(H, 0)-(0, W)-(0, 0), img2
  535.  
  536.     img3 = _NEWIMAGE(H, W, D)
  537.     _PUTIMAGE , img2, img3, (1, W)-(H, 1) '270
  538.     _CLEARCOLOR CC, img1
  539.     _CLEARCOLOR CC, img2
  540.     _CLEARCOLOR CC, img3
  541.  
  542. FUNCTION MaximalRowLenght (i)
  543.     MaximalRowLenght = 0
  544.     REDIM test(0) AS STRING
  545.     ClearColorRecordsAndVauesFromTextArray TBA2(i).I_s, TBA2(i).I_e, test()
  546.  
  547.     FOR p = LBOUND(test) TO UBOUND(test)
  548.         IF MaximalRowLenght < LEN(test(p)) THEN MaximalRowLenght = LEN(test(p))
  549.     NEXT
  550.  
  551. SUB ClearColorRecordsAndVauesFromTextArray (start, eend, arrname() AS STRING) 'If we need find maximal row lenght, first must color tags be deleted from text.
  552.     REDIM arrname(eend - start) AS STRING
  553.     FOR c = start TO eend
  554.         FOR L = 1 TO LEN(GlobalText(c))
  555.             ch$ = MID$(GlobalText(c), L, 1)
  556.             IF ch$ = "/" THEN iscolor = 1
  557.             IF iscolor AND ASC(ch$) > 47 AND ASC(ch$) < 58 THEN ELSE t$ = t$ + ch$
  558.             IF iscolor AND ASC(ch$) < 47 OR iscolor AND ASC(ch$) > 58 THEN
  559.                 iscolor = 0
  560.             END IF
  561.         NEXT
  562.         arrname(c - start) = t$
  563.         t$ = ""
  564.     NEXT c
  565.  
  566. 'End of future "TextBox.BM"
  567.  


Program output:

  [ You are not allowed to view this attachment ]  

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Scroll Bar
« Reply #73 on: October 04, 2019, 10:58:46 pm »
Here’s an idea I just had for a 3D window:  Us OpenGL to map textures of segments an image to a cube.  Let the “sliders” rotate the cube left/right, up/down...  It’d basically scroll a screen of text at a time...

If I find time, while the concept is fresh in my head, I might take a shot at having fun and doing it, but you guys are also free to have fun with it if you want.  I think it’d make a cute little 3D- scroller.  😁
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!