August 25, 2019, 12:20:14 AM

Author Topic: Need help with broken?! Scollpanels  (Read 193 times)

Offline Grisu

  • Jr. Member
  • **
  • Posts: 24
    • Pocket Radio Player
Need help with broken?! Scollpanels
« on: July 14, 2019, 08:07:21 PM »
Hi all,

I'm trying to make gadgets (textfields, comboboxes, labels etc) to resize properly on a scollpanel... and failed so far.
I would like to increase the width of my app's window and at the same time to increase the width of the gadgets placed on the scrollpanel as well.
Without the scrollpanel every gadget adjustment works fine aka increases its width properly. But once placed on the scrollpanel, it seems to be "locked" in place?!

Below is a simplified example code of the framework that I'm using. I need to make it work within these edge cases.

Code: [Select]
SuperStrict

Framework MaxGui.Drivers
 Import BRL.GLMax2D
 Import BRL.StandardIO
 Import BRL.Pixmap
 Import BRL.EventQueue
 Import BRL.Timer
 Import BRL.Retro
 Import BRL.Max2D
 Import BRL.Pngloader
 Import BRL.Jpgloader
 Import Maxgui.ProxyGadgets

Const MAINWINDOW_W:Int = 278
Const MAINWINDOW_H:Int = 154
Const BUTTONSIZE:Byte = 30
Const LABEL_STARTY:Byte = 3

?win32
Const PNL_HEIGHT:Int = 22
Const SLIDER_WIDTH:Int = 22
Const WIN_MENU_FLAG:Int = 0
?

Global SpectrumTimer:TTimer=CreateTimer(24)

' //////  Main Window
Global icol:Int
Global flags:Int=WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS | WINDOW_CENTER | WIN_MENU_FLAG | WINDOW_ACCEPTFILES | WINDOW_RESIZABLE
Global MainWindow:TGadget=CreateWindow("Scrollbar Test",0,0,MAINWINDOW_W,MAINWINDOW_H,Null, flags)

Global Button2:TGadget=CreateButton("Exit APP",2,MAINWINDOW_H-BUTTONSIZE,MAINWINDOW_W-3,BUTTONSIZE,MainWindow,BUTTON_OK)
SetGadgetLayout Button2,EDGE_ALIGNED,EDGE_ALIGNED,Null,EDGE_ALIGNED

' //////  Creator Panel
Global CreatorPanel:TGadget = CreatePanel(0, 0, MAINWINDOW_W, MAINWINDOW_H, MainWindow)', PANEL_ACTIVE)
SetGadgetLayout CreatorPanel, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED

Global CreatorPanel_White: TGadget = CreatePanel(0, 0, MAINWINDOW_W, 22, CreatorPanel)',PANEL_SUNKEN)
SetGadgetLayout CreatorPanel_White, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, Null
SetGadgetColor CreatorPanel_White,255,255,255

Global Label_creator1:TGadget=CreateLabel:TGadget("Editor",2,LABEL_STARTY,MAINWINDOW_W-80-6,16,CreatorPanel_White,LABEL_LEFT)
?Not Linux
 SetGadgetFont( Label_creator1, LookupGuiFont( GUIFONT_SYSTEM, 0, FONT_BOLD) )
?
SetGadgetLayout Label_creator1, EDGE_ALIGNED, Null, EDGE_ALIGNED, Null

Global CreatorScrlMain:TScrollPanel = CreateScrollPanel(0,22, MAINWINDOW_W, MAINWINDOW_H-3-BUTTONSIZE-3-19, CreatorPanel,SCROLLPANEL_HNEVER)'|SCROLLPANEL_SUNKEN)', SCROLLPANEL_VNEVER)', SCROLLPANEL_SUNKEN)
SetGadgetLayout CreatorScrlMain,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED
SetGadgetSensitivity(CreatorScrlMain , SENSITIZE_MOUSE)

Global CreatorClient:TGadget = ScrollPanelClient(CreatorScrlMain)
SetGadgetLayout Creatorclient,Null, Null, EDGE_ALIGNED,EDGE_ALIGNED
SetGadgetSensitivity(CreatorClient , SENSITIZE_MOUSE)

Global Creator_NameTextField:TGadget = CreateTextField(3,3,MAINWINDOW_W-3-SLIDER_WIDTH-30, PNL_HEIGHT, CreatorClient)
SetGadgetLayout Creator_NameTextField, EDGE_ALIGNED, Null, EDGE_ALIGNED, Null

Global Creator_UrlTextField:TGadget = CreateTextField(3,3+PNL_HEIGHT+2,MAINWINDOW_W-3-SLIDER_WIDTH-30, PNL_HEIGHT, CreatorClient)
SetGadgetLayout Creator_UrlTextField, EDGE_ALIGNED, Null, EDGE_ALIGNED, Null

Global Creator_GenreListbox1:TGadget     = CreateComboBox(3,1+PNL_HEIGHT*2+14, MAINWINDOW_W-3-SLIDER_WIDTH-30, PNL_HEIGHT, CreatorClient)
SetGadgetLayout Creator_GenreListbox1, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED ' Show when window height increases...
AddGadgetItem Creator_GenreListbox1,"Listbox Text 01", GADGETITEM_NORMAL, -1, "0"
SelectGadgetItem(Creator_GenreListBox1,0)

Global Creator_GenreListbox2:TGadget     = CreateComboBox(3,1+PNL_HEIGHT*5+14, MAINWINDOW_W-3-SLIDER_WIDTH-30, PNL_HEIGHT, CreatorClient)
SetGadgetLayout Creator_GenreListbox2, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED ' Show when window height increases...
AddGadgetItem Creator_GenreListbox2,"Listbox Text 02", GADGETITEM_NORMAL, -1, "0"
SelectGadgetItem(Creator_GenreListBox2,0)

FitScrollPanelClient( CreatorScrlMain , SCROLLPANEL_SIZETOKIDS )

' ///// Set Window Dimensions
SetMinWindowSize(MainWindow,MAINWINDOW_W,MAINWINDOW_H)
SetMaxWindowSize(MainWindow,600,DesktopHeight())

' ///// Main Loop

While WaitEvent()
Select EventID()
Case EVENT_WINDOWCLOSE
End
Case EVENT_GADGETACTION
          Select EventSource()

                 Case BUTTON2
          End
                 End Select

       Case EVENT_TIMERTICK

    Select EventSource()

Case SpectrumTimer
        End Select

End Select
 
Wend
End

Thanks in advance for your support
Grisu
Pocket Radio Player     Cardwar