Author Topic: Scroll Bar  (Read 13405 times)

0 Members and 1 Guest are viewing this topic.

Offline Erum

  • Newbie
  • Posts: 10
    • View Profile
Re: Scroll Bar
« Reply #45 on: September 23, 2019, 11:57:29 am »
To all the respected QB64 team,
Thank you for all those who helped me so much once again. However, I have one last dumb question.
I am done with the whole software, all I need is to add colours. My software is a bit crowded, so I thought adding colours would make the data vivid and easy to read.
I know how to add colours to each line using RGB mixing, but I want to know if it is possible to add more than one colour on one line (text colour only).
I would be grateful to anyone who takes precious time to answer this dumb question.
Regards.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Scroll Bar
« Reply #46 on: September 23, 2019, 12:43:20 pm »
Here is an example:
Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32) 'for _rgb32 colors
  2. _SCREENMOVE 300, 60 'to get the screen out of B+ title and tool bars
  3.  
  4. txt$ = "Hello world, let me show you a multi-colored string, in just one longish line."
  5.  
  6. 'the MID$ function takes portions of a string
  7. FOR i = 1 TO LEN(txt$) STEP 5 'print txt$ 5 chars at a time
  8.     'reset the ink of print
  9.     COLOR _RGB32(RND * 255, RND * 255, RND * 155 + 100)
  10.     PRINT MID$(txt$, i, 5);
  11.  
  12.  

PS It is not dumb to ask questions, neither dumb intellectually nor dumb in speech.
« Last Edit: September 23, 2019, 12:49:33 pm by bplus »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Scroll Bar
« Reply #47 on: September 23, 2019, 01:04:05 pm »
It is not dumb to ask questions, neither dumb intellectually nor dumb in speech.

I couldn’t agree more!  All software, and new experiences, require a learning curve.  By asking questions, and finding friendly folks who will take the time to answer them, you can reduce that learning curve immensely.  It’s not dumb to ask questions; and the only people who thinks it is, are the true idiots.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Erum

  • Newbie
  • Posts: 10
    • View Profile
Re: Scroll Bar
« Reply #48 on: September 23, 2019, 02:37:00 pm »
Respected QB64 members,
Thank you for making me feel confident for asking questions, you truly are friendly folks. As for the reply, I understood it, and I’ll use it. Thank you!
My queries are officially over. Thanks once more to everyone.
Regards.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Scroll Bar
« Reply #49 on: September 23, 2019, 03:02:23 pm »
about
Quote
PS It is not dumb to ask questions, neither dumb intellectually nor dumb in speech.

in my country there is a phrase from the XIX/XX century : "Chi tene a lengua va in Sardegna!"
translating from Dialect to Italian and from italian to English literally "if you have the tongue you can go to Sardegna !" but for the sense is better "You can go anywhere also to a difficult country to reach like the isle Sardegna if you  use your tongue to talk, to ask, to thank"

about developing a scrollbar function
what do you like to do? Complete or stop the developing?
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 #50 on: September 23, 2019, 03:04:18 pm »
Hi again.


Finally, I finished what I promised. So ... I tried it for 256 colors only, I will add support for truecolor hexadecimal colors (now must be writed as  unsigned long number) . So far, it works like this:

(Added support for PgUP, PgDn, Up, Dn)

Despite the fact that Erum will probably no use it, because as she write, is done, i add to this thread the promised second type of textbox + third with a shift in all axes. It will certainly be useful to someone later. (And I enjoy it).

Best joke from testing this program?  Hell, why is text not show? Why it works not if use colors? Yeah, man. 32 bit screen and used 8 bit colors...

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. TBA(0).Arrow = PutArrow&
  22. 'real textboxes starting from 1
  23.  
  24. 'end of future "TextBox.BI"
  25.  
  26.  
  27. DIM test(10) AS LONG
  28.  
  29. FOR t = 1 TO 10
  30.     test(t) = INITBOX(100 + 250 * RND, 40 * t - 27, "/5Hi, /14I'm working on it./1 This /2is the /15test/14 text/15 of the program for /78longitudinal scrolling /14in the /90window./14 Color capabilities will be added soon. /8The program uses arrays because program need to remember the shift values for more than one /50b/60o/20x.", 15 + RND * 40)
  31. Demo = INITBOX(150, 500, "/17T/18h/19i/20s /21i/22s/23 s/24m/25a/26l/27l /28t/29e/30x/31t", 9)
  32.  
  33.  
  34.  
  35.     FOR p = 1 TO 10
  36.         PRINTBOX p
  37.     NEXT
  38.     PRINTBOX Demo
  39.  
  40.     _DISPLAY
  41.  
  42. 'this is future "TextBox.BM"
  43.  
  44. FUNCTION INITBOX (X AS INTEGER, Y AS INTEGER, Text AS STRING, BoxLenght AS INTEGER) 'X, Y are GRAPHIC coordinates
  45.     UTB = UBOUND(tba)
  46.     REDIM _PRESERVE TBA(UTB + 1) AS TB
  47.     TBA(UTB + 1).X = X
  48.     TBA(UTB + 1).Y = Y
  49.     TBA(UTB + 1).L = BoxLenght
  50.     CString Text, text2$, k(), UTB + 1
  51.     k(UBOUND(k) - 1).flag = UTB + 1
  52.     TBA(UTB + 1).T = text2$
  53.     TBA(UTB + 1).B = 1
  54.     INITBOX = UTB + 1
  55.  
  56.  
  57. SUB PRINTBOX (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.     BBL = boxl / 100 * BL
  116.  
  117.     'posuvnik
  118.     LINE (Actual, Y + TextHeight + 5)-(Actual + BBL, Y + TextHeight * 2 - 3), White~&, BF
  119.     LINE (Actual, Y + TextHeight + 5)-(Actual + BBL, Y + TextHeight * 2 - 3), Grey2~&, B
  120.  
  121.  
  122.     IF MX >= Actual AND MX <= Actual + BBL THEN
  123.         IF MY >= Y + TextHeight + 5 AND MY <= Y + TextHeight * 2 - 3 THEN
  124.             IF MB1 THEN
  125.                 omx = MX
  126.                 DO UNTIL _MOUSEX <> MX
  127.                     WHILE _MOUSEINPUT: WEND
  128.                     MB1 = _MOUSEBUTTON(1)
  129.                     B = B + _MOUSEX - omx
  130.                 LOOP
  131.             END IF
  132.         END IF
  133.     END IF
  134.  
  135.  
  136.     _PUTIMAGE (X + 15 + BoxLenght * _FONTWIDTH, Y + TextHeight + 1), TextBoxArrow&
  137.     _PUTIMAGE (X - 15, Y + TextHeight + 1)-(X - 27, Y + TextHeight + 1 + 12), TextBoxArrow&
  138.  
  139.     IF TIMER < 1 THEN TBA(nr).D = 0
  140.  
  141.     IF MX >= X + 15 + BoxLenght * _FONTWIDTH AND MX <= X + 15 + BoxLenght * _FONTWIDTH + 12 THEN
  142.         IF MY >= Y + 1 + TextHeight AND MY <= Y + TextHeight * 2 THEN
  143.             IF TBA(nr).D < TIMER THEN
  144.                 IF _PIXELSIZE = 4 THEN
  145.                     LINE (X + 15 + BoxLenght * _FONTWIDTH, Y + TextHeight + 1)-(X + 15 + BoxLenght * _FONTWIDTH + 11, Y + TextHeight * 2), &H44FFFFFF, BF
  146.                 ELSE
  147.                     LINE (X + 15 + BoxLenght * _FONTWIDTH, Y + TextHeight + 1)-(X + 15 + BoxLenght * _FONTWIDTH + 11, Y + TextHeight * 2), 14, B
  148.                 END IF
  149.                 IF MB1 THEN
  150.                     B = B + 1
  151.                 END IF
  152.                 TBA(nr).D = TIMER + .01
  153.             END IF
  154.         END IF
  155.     END IF
  156.  
  157.     IF MX >= X - 26 AND MX <= X - 15 THEN
  158.         ' IF MY >= Y + 1 AND MY <= Y + 13 THEN
  159.         IF MY >= Y + 1 + TextHeight AND MY <= Y + TextHeight * 2 THEN
  160.  
  161.             SELECT CASE _KEYHIT
  162.                 CASE 18176: B = 1
  163.                 CASE 20224: B = LEN(TBA(nr).T) - TBA(nr).L + 1
  164.                 CASE 18688: B = B - TBA(nr).L
  165.                 CASE 20736: B = B + TBA(nr).L
  166.             END SELECT
  167.  
  168.  
  169.             IF TBA(nr).D < TIMER THEN
  170.                 IF _PIXELSIZE = 4 THEN
  171.                     LINE (X - 26, Y + TextHeight + 1)-(X - 15, Y + TextHeight * 2), &H44FFFFFF, BF
  172.                 ELSE
  173.                     LINE (X - 26, Y + TextHeight + 1)-(X - 15, Y + TextHeight * 2), 14, B
  174.                 END IF
  175.                 IF MB1 THEN
  176.                     B = B - 1
  177.                 END IF
  178.                 TBA(nr).D = TIMER + .01
  179.             END IF
  180.         END IF
  181.     END IF
  182.     IF B < 1 THEN B = 1
  183.     IF B > LEN(TBA(nr).T) - TBA(nr).L + 1 THEN B = LEN(TBA(nr).T) - TBA(nr).L + 1
  184.     TBA(nr).B = B
  185.  
  186.     IF _PIXELSIZE = 4 THEN COLOR &HFFFFFFFF ELSE COLOR 15
  187.  
  188.  
  189.     FOR V = 1 TO LEN(TBA(nr).T)
  190.         FOR t = LBOUND(k) + 1 TO UBOUND(k)
  191.             IF k(t).flag = nr THEN
  192.                 IF V = k(t).onpos + 1 THEN COLOR k(t).clr: EXIT FOR
  193.             END IF
  194.         NEXT
  195.  
  196.         IF V >= B AND V <= B + TBA(nr).L THEN
  197.             _PRINTSTRING (X + (W * _FONTWIDTH), Y), MID$(TBA(nr).T, V, 1)
  198.             W = W + 1
  199.         END IF
  200.     NEXT
  201.  
  202.  
  203.  
  204. FUNCTION PutArrow&
  205.     IF _PIXELSIZE = 4 THEN
  206.         PutArrow& = _NEWIMAGE(12, 12, 32)
  207.     ELSE
  208.         PutArrow& = _NEWIMAGE(12, 12, 256)
  209.     END IF
  210.  
  211.     D = _DEST
  212.     _DEST PutArrow&
  213.  
  214.     LINE (1, 4)-(6, 4) '  ------------     up
  215.     LINE (1, 8)-(6, 8) '  ------------     down
  216.     LINE (1, 4)-(1, 8) '  I                arrow back
  217.     LINE (6, 4)-(6, 1)
  218.     LINE (6, 8)-(6, 11)
  219.     LINE (6, 11)-(11, 6)
  220.     LINE (6, 1)-(11, 6)
  221.  
  222.     IF _PIXELSIZE(D) = 4 THEN PAINT (6, 6), &HFF777777, &HFFFFFFFF ELSE PAINT (6, 6), 10, 15
  223.     IF _PIXELSIZE(D) = 4 THEN _CLEARCOLOR &HFF000000, PutArrow& ELSE _CLEARCOLOR 0, PutArrow&
  224.     _DEST D
  225.  
  226. SUB CString (source AS STRING, text AS STRING, K() AS Colored, index AS INTEGER)
  227.     FOR S = 1 TO LEN(source$)
  228.         t$ = MID$(source$, S, 1)
  229.         IF ASC(t$) >= 48 AND ASC(t$) <= 57 AND incolor THEN colornr$ = colornr$ + t$
  230.         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
  231.         IF t$ = "/" THEN
  232.             D = D + 1
  233.             incolor = 1
  234.             REDIM _PRESERVE K(UBOUND(k) + 1) AS Colored
  235.             kk = UBOUND(k)
  236.             K(kk).onpos = S - D
  237.             K(kk).flag = index
  238.         END IF
  239.         IF incolor = 0 THEN text$ = text$ + t$
  240.     NEXT
  241.  
  242. 'End of future "TextBox.BM"
  243.  
  244.  
  245.  
  246.  

EDIT: Myself found critical bug: Colors from previous call was used also for next call, for next string. REPAIRED in this version. Now all strings use colors as expected. (Bug is also visible on attached image - word's "This" expected color was white. Now it is ok.


  [ You are not allowed to view this attachment ]  

« Last Edit: September 23, 2019, 04:11:28 pm by Petr »

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Scroll Bar
« Reply #51 on: September 23, 2019, 03:13:37 pm »
Hi Bplus
I find your version of scrollbar fine and working.
  [ You are not allowed to view this attachment ]  

Hi Petr
very fine multicolor on the same raw of text...
« Last Edit: September 23, 2019, 03:36:18 pm by TempodiBasic »
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 #52 on: September 23, 2019, 03:48:13 pm »
Quote
about developing a scrollbar function
what do you like to do? Complete or stop the developing?

I am glad we could eventually help Erum. But she has sort of opened a can of worms with this scrollbar(s) thing.

Petr's and TempodiBasic's interest along with mine have been peaked, I think. I confess I was not particularly interested in a horizontal text scroller but having finished a pretty nice one, I am curious about doing text with a double scrollbar vertical and horizontal. Now Steve has sort of started that topic but also speaks of resizeable programs?? here https://www.qb64.org/forum/index.php?topic=1719.msg109557#msg109557
WTH resizeable programs??? I think he just tapped this section of code out of something bigger that makes more sense as a whole.

So I am wondering should we continue discussion here with the horizontal text conquered or should we move to Steve's thread and try and improve on his double scrollbars by connecting up mouse and normal keys arrows, home. end, pgUp, pgDn... mouse Clicks, mouse dragging, mouse wheel to the scrollers?

There is one other underlying issue to consider, the control of mouse and key inputs over the whole screen which might contain several scrollbars, mouse click or drag areas, say for buttons or lists or text boxes... going this far in thinking ahead, I see we have arrived at on InForm like GUI! (I arrived at this central mouse and key controller problem with Tiny Navigator trying to do 2 Lists to select from Files or Directories.) So now I wonder is it worth the time for working out double scrollbars for giant text which will likely mean a central controller for all mouse and key activity in order to actually use it in an app. ???

Now my head hurts ;-))

Well we are in the Discussion board, so let's continue discussion here if it pleases Petr and TempodiBasic and anyone else interested in this coding problem.





Offline Bert22306

  • Forum Regular
  • Posts: 206
    • View Profile
Re: Scroll Bar
« Reply #53 on: September 23, 2019, 03:59:05 pm »
Yeah, Bplus, Tempo, Steve, and Petr, this discussion started by Erum has been great. Very educational. Always nice to find ways to make QB64 programs look more modern and less DOS-like.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Scroll Bar
« Reply #54 on: September 23, 2019, 04:17:12 pm »
An upgraded version of my scroll bar system, now that I have a few moments free to flesh it out:

Code: QB64: [Select]
  1. DIM SHARED WorkScreen AS LONG, DisplayScreen AS LONG
  2.  
  3. WorkScreen = _NEWIMAGE(3600, 2400, 32) ' a nice large screen so we can scroll like crazy
  4. DisplayScreen = _NEWIMAGE(640, 480, 32) 'a nice small display screen
  5.  
  6. SCREEN DisplayScreen
  7. _DEST WorkScreen
  8. PRINT "Let's print all sorts of stuff on our workscreen, and make certain that it's more than long enough so that it'll scroll quite a ways across from the normal screen."
  9. LINE (400, 400)-(3000, 1200), &HFFFFFF00, BF
  10. FOR i = 1 TO 145
  11.     COLOR _RGB32(RND * 256, RND * 256, RND * 256), 0 'various colors for each line
  12.     PRINT "LINE #"; i; ".  This is just a bunch of junk for testing purposes only.  As you can see, if you want to read all the text from this line, you're going to have to scroll to see it all."
  13.  
  14.  
  15.  
  16.  
  17.  
  18. StartX = 0: StartY = 0: W = _WIDTH(DisplayScreen): H = _HEIGHT(DisplayScreen)
  19. _DEST DisplayScreen
  20.         temp = _NEWIMAGE(_RESIZEWIDTH, _RESIZEHEIGHT, 32)
  21.         SCREEN temp
  22.         _FREEIMAGE DisplayScreen
  23.         DisplayScreen = temp
  24.         W = _WIDTH(DisplayScreen): H = _HEIGHT(DisplayScreen)
  25.         _DELAY .25
  26.         junk = _RESIZE 'clear the resize flag after manually setting the screen to the size we specified.
  27.     END IF
  28.     _LIMIT 30
  29.     CLS
  30.     ScrollBar StartX, 2
  31.     ScrollBar StartY, 1
  32.  
  33.     k = _KEYHIT
  34.     SELECT CASE k
  35.         CASE ASC("A"), ASC("a"), 19200: StartX = StartX - 10: IF StartX < 0 THEN StartX = 0
  36.         CASE ASC("S"), ASC("s"), 20480: StartY = StartY + 10: IF StartY > _HEIGHT(WorkScreen) - H THEN StartY = _HEIGHT(WorkScreen) - H
  37.         CASE ASC("D"), ASC("d"), 19712: StartX = StartX + 10: IF StartX > _WIDTH(WorkScreen) - W THEN StartX = _WIDTH(WorkScreen) - W
  38.         CASE ASC("W"), ASC("w"), 18432: StartY = StartY - 10: IF StartY < 0 THEN StartY = 0
  39.     END SELECT
  40.         IF _MOUSEX > W - 21 AND _MOUSEY < H - 20 THEN 'We're on a up/down scroll bar
  41.             StartY = _MOUSEY / _HEIGHT(DisplayScreen) * _HEIGHT(WorkScreen)
  42.             IF StartY > _HEIGHT(WorkScreen) - H THEN StartY = _HEIGHT(WorkScreen) - H
  43.         END IF
  44.         IF _MOUSEY > H - 21 AND _MOUSEX < W - 20 THEN 'we're on the left/right scroll bar
  45.             StartX = _MOUSEX / _WIDTH(DisplayScreen) * _WIDTH(WorkScreen)
  46.             IF StartX > _WIDTH(WorkScreen) - W THEN StartX = _WIDTH(WorkScreen) - W
  47.         END IF
  48.     END IF
  49.  
  50.     _PUTIMAGE (0, 0)-(W - 20, H - 20), WorkScreen, DisplayScreen, (StartX, StartY)-STEP(W, H)
  51.     _DISPLAY
  52.  
  53.  
  54.  
  55.  
  56.  
  57. SUB ScrollBar (Start, Direction)
  58.     D = _DEST: _DEST DisplayScreen 'our scrollbars show on the display
  59.     Min = 0
  60.     MaxH = _HEIGHT(DisplayScreen)
  61.     MaxW = _WIDTH(DisplayScreen)
  62.     H = _HEIGHT(WorkScreen)
  63.     W = _WIDTH(WorkScreen)
  64.     IF Direction = 1 THEN 'up/down bar
  65.         Box MaxW - 20, 0, 20, MaxH - 20, &HFF777777, &HFFFFFFFF
  66.         Box MaxW - 19, Start / H * MaxH, 18, MaxH / H * MaxH - 20, &HFFFF0000, 0 'Red with transparent
  67.     ELSE 'left/right bar
  68.         Box Min, MaxH - 20, MaxW - 20, 20, &HFF777777, &HFFFFFFFF 'Gray with white border
  69.         Box Start / W * MaxW, MaxH - 19, MaxW / W * MaxW - 20, 18, &HFFFF0000, 0 'Red with transparent
  70.     END IF
  71.     _DEST D
  72.  
  73.  
  74. SUB Box (x, y, wide, high, kolor AS _UNSIGNED LONG, border AS _UNSIGNED LONG)
  75.     LINE (x, y)-STEP(wide, high), kolor, BF
  76.     LINE (x, y)-STEP(wide, high), border, B
  77.  

Arrow keys scroll, and you can use the mouse to maneuver via the scroll bars if you hold the left mouse down while over one of them.  The window is also resizable, with the scroll bars automatically adjusting to the new window sizes.   Test it out, and see what you think of it.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Scroll Bar
« Reply #55 on: September 23, 2019, 05:14:38 pm »
I think about it the best. :) Good work, Steve.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Scroll Bar
« Reply #56 on: September 23, 2019, 05:29:51 pm »
I think about it the best. :) Good work, Steve.

Well I wonder if Steve or anyone can put can put N text boxes up with double scrollers on the same screen like we were doing for text hScrollers with mouse wheel and other key presses also of course!  ;-))

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Scroll Bar
« Reply #57 on: September 23, 2019, 05:38:32 pm »
Well I wonder if Steve or anyone can put can put N text boxes up with double scrollers on the same screen like we were doing for text hScrollers with mouse wheel and other key presses also of course!  ;-))

Sure.  Just make each scroll area independent, and assign them their own unique handle,  like with my little text frames routines.  All this demo needed was to make a screen adjustable/scrollable, but all you do is apply the same principle to any given screen regions — one screen of set size to draw/write on, a second screen to display a portion of it on via _PUTIMAGE, with the scroll bars just being X/Y incremental tools.  (Which is all they do above for us.)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Scroll Bar
« Reply #58 on: September 23, 2019, 05:44:49 pm »
about

Quote
So I am wondering should we continue discussion here with the horizontal text conquered or should we move to Steve's thread

Here my answer to unify the threads https://www.qb64.org/forum/index.php?topic=1719.msg109796#msg109796

about this issue
Quote
So now I wonder is it worth the time for working out double scrollbars for giant text which will likely mean a central controller for all mouse and key activity in order to actually use it in an app. ???

IMHO when we go to think as objects or entities to use in our programs we have two option...
1.  centered managing of mouse and keyboard and other input ways  ,
      so we can think about it like a pyramid that has like apex the I/O routine to be directed to the right entity at bottom,
      or like a collection of areas to be activated by a flag (in Windows there are the messages among objects)
2. a plane or circular managing of I/O  in which the objects/entities have the own different action that is activated by the specific
    position of the mouse and by the specific comboKey

the substantial difference between them is that in the first the apex manages I/O and triggers entity's action, in the second there is a main loop in which each entity tests if position of mouse and combokey activate its action/s.

just as example about previous scrolling horizonthal
in the first kind of  multi entities  there is a main loop that catches I/O  and activate the single scrolling bar...
in the second kind of multi entities, one at time  each entity tests if it must react ot I/O so there is a main loop that cycles among all entities

so in the first kind each entity has a value or code to be activated and disactivated
while in the second kind each entity has an entry of parameters and a routine to activate itself.

Waiting your opinion
Thanks to read
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 #59 on: September 23, 2019, 05:56:22 pm »
Quote
Sure.  Just make each scroll area independent, and assign them their own unique handle,  like with my little text frames routines.  All this demo needed was to make a screen adjustable/scrollable, but all you do is apply the same principle to any given screen regions — one screen of set size to draw/write on, a second screen to display a portion of it on via _PUTIMAGE, with the scroll bars just being X/Y incremental tools.  (Which is all they do above for us.)


I'll do it differently. I'll do it with PRINTSTRING (none PUTIMAGE). Yeah, if I wanted to make a slider for pictures with text, that would be harder. To solve the text flow around the picture .... I can think of several possibilities, but I will stay with the text. Of course it will take a while, but it won't be a problem. Of course there will be an unlimited number (according to RAM) of these dialogs on the monitor. I think, i need 2 or 3 days for it (i have very limited time for programming now).


So far, I say goodbye because here is midnight.
« Last Edit: September 23, 2019, 06:04:24 pm by Petr »