Window inside a window with a Litdev scrollbar?

asked 2021-11-06T15:20:39.46+00:00
KeepItPrivate 1 Reputation point

I'm trying to code a user interface that has some buttons on top and the bottom part will show the output with a scrollbar:

147022-scrollablewindowinsidewindow.png

So far I can add buttons and a vertical scrollbar over the whole height of my graphics window. If I scroll down, all the buttons are affected too and move. How can place buttons on top and have a smaller window or viewport at the bottom?

Small BASIC
Small BASIC
A programming language created by Microsoft that serves a stepping stone for beginners from block-based coding languages to more complex text-based languages.
259 questions
No comments
{count} votes

3 answers

Sort by: Most helpful
  1. answered 2021-11-06T21:47:28.34+00:00
    Scout 531 Reputation points

    A text window is sufficient, the content of which can also be deleted.

    147007-ldcontrols-addrichtextbox-source.jpg

    146966-ldcontrols-addrichtextbox.jpg

    No comments

  2. answered 2021-11-07T13:32:59.707+00:00
    KeepItPrivate 1 Reputation point

    I forgot to say that the output will contain images, buttons and text. I thought about a rich text box too, but I haven't figured out how to add images and buttons inside one. Here's a simplified version of my current code:

    GraphicsWindow.Width = 640
    GraphicsWindow.Height = 480
    
    topbutton = Controls.AddButton("I'm just here as an example", 8, 8)
    Controls.SetSize(topbutton, 200, 24)
    
    scrollbarheight = 20 * 32 + 40 ' total of height equals 20 buttons with space inbetween and the top button
    LDScrollBars.Add(0, scrollbarheight)
    
    y = 40 ' where the buttons below will start
    
    for i = 1 To 20
      button[i] = Controls.AddButton(i , 8, y)
      Controls.SetSize(button[i], 200, 24)
      y = y + 32
    EndFor
    
    No comments

  3. answered 2021-12-30T01:57:17.843+00:00
    JR 121 Reputation points

    KeepItPrivate,

    Why not try this with LDWindows and have the 2 windows overlay each other. The top window could have the buttons that you don't want to scroll off of the screen and for the bottom window you could use LDScrollBars.
    On that window you could have a vertical scroll bar. If you add buttons, text or shapes to this window they will scroll when you move the scrollbar.

    JR

    No comments