Scrolleable Area for Panel

Just starting out? Need help? Post your questions and find answers here.
TUGI.CH
New User
New User
Posts: 2
Joined: Sun Apr 09, 2023 11:19 am

Scrolleable Area for Panel

Post by TUGI.CH »

Hi everyone.

How can I create a scrollbar when the panel is dynamically expanded by buttons and input fields?
It's the right part of this screenshot: https://blog.tugi.ch/wp-content/uploads ... /image.png

Thanks for your help! ;-)
Regards, Tugi
Greetings
TUGI
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Scrolleable Area for Panel

Post by infratec »

There is a ScrollAreaGadget().

Switch to Panel 2 and wait 5 seconds:

Code: Select all

If OpenWindow(0, 0, 0, 322, 220, "PanelGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  PanelGadget(0, 8, 8, 306, 203)
  AddGadgetItem(0, -1, "Panel 1")
  
  PanelGadget(1, 5, 5, 290, 166)
  AddGadgetItem(1, -1, "Sub-Panel 1")
  AddGadgetItem(1, -1, "Sub-Panel 2")
  AddGadgetItem(1, -1, "Sub-Panel 3")
  CloseGadgetList()
  
  AddGadgetItem(0, -1,"Panel 2")
  ScrollAreaGadget(77, 0, 0, 300, 200, 300, 150)
  ButtonGadget(2, 10, 15, 80, 24,"Button 1")
  ButtonGadget(3, 95, 15, 80, 24,"Button 2")
  CloseGadgetList()
  
  AddWindowTimer(0, 1, 5000)
  
  Repeat
    Event = WaitWindowEvent()
    Select Event
      Case #PB_Event_CloseWindow
        Exit = #True
        
      Case #PB_Event_Timer
        If EventTimer() = 1
          Debug "Timer"
          RemoveWindowTimer(0, 1)
          OpenGadgetList(77)
          CanvasGadget(99, 10, 80, 100, 600, #PB_Canvas_Border)
          CloseGadgetList()
          SetGadgetAttribute(77, #PB_ScrollArea_InnerHeight, 700)
        EndIf
        
    EndSelect
  Until Exit
EndIf
TUGI.CH
New User
New User
Posts: 2
Joined: Sun Apr 09, 2023 11:19 am

Re: Scrolleable Area for Panel

Post by TUGI.CH »

Thank you so much! ;-)
Greetings
TUGI
Post Reply