Page 1 of 1
Groupbox width [#13888]
Posted: Sat Dec 31, 2016 5:17 pm
by Gingernut63
On options page Tools > Options > Player the GroupBoxes adjust their width to the resizing of the window.
How do you program a GroupBox to do that, or is that function not available outside of the main program?
Re: Groupbox width
Posted: Sat Dec 31, 2016 9:36 pm
by Peke
You temper with Object Anchors.
Example where you anchor Top Left in order to allow group Box to resize correctly
http://www.mediamonkey.com/wiki/index.p ... n::Anchors
Code: Select all
This is test
|--------------|
| |
| |
|--------------|
Re: Groupbox width
Posted: Sun Jan 01, 2017 5:07 pm
by Gingernut63
Thanks for the reply Pavle, I have used Anchors for buttons, just didn't think to use for GroupBoxes.
I'm having problems getting this to work correctly, hence the delay in the response.
I have four GroupBoxes on an options sheet. All four use the same code format as below. Opening the options sheet the first time all GroupBoxes work as intended, changing width as the window width is adjusted.
After clicking OK and reopening the options page the first GroupBox's width has reduced dramatically, as though the Sheet.Common.Width parameter is now -600. Standard width for my page is 780 to show all information. It remains like this no matter how many times the options page is reopened. The following three GroupBoxes work perfectly. It doesn't matter whether there are 1,2,3 or 4 GroupBoxes, the first coded GroupBox (as below) always has the same issue.
Any thoughts?
Code: Select all
Set Panel1 = SDB.UI.NewGroupBox(Sheet)
Panel1.Common.SetRect 10,5,Sheet.Common.Width -20,55
Panel1.Common.Anchors = 1+2+4
Re: Groupbox width
Posted: Wed Jan 04, 2017 7:39 pm
by Peke
Can you make screenshot showing the direction of resize that do not work?
Re: Groupbox width
Posted: Fri Jan 06, 2017 3:51 pm
by Gingernut63
Peke wrote:Can you make screenshot showing the direction of resize that do not work?
Two screen shots (before and after) plus code. The first image is the first time the options page is opened. The second is what it looks like every time it is opened thereafter, even if the options page window is resized.
Code: Select all
Sub OnStartup
Dim ind
ind = SDB.UI.AddOptionSheet("TestSheet",Script.ScriptPath,"InitSheet","SaveSheet",-2)
End Sub
Sub InitSheet(Sheet)
Dim form, Panel1, Panel2, Panel3, Panel4
Set Panel1 = SDB.UI.NewGroupBox(Sheet)
Panel1.Common.SetRect 10,5,Sheet.Common.Width -20,50
Panel1.Common.Anchors = 1+2+4
Panel1.Caption = "Panel 1"
Set Panel2 = SDB.UI.NewGroupBox(Sheet)
Panel2.Common.SetRect 10,65,Sheet.Common.Width -20,50
Panel2.Common.Anchors = 1+2+4
Panel2.Caption = "Panel 2"
Set Panel3 = SDB.UI.NewGroupBox(Sheet)
Panel3.Common.SetRect 10,125,Sheet.Common.Width -20,50
Panel3.Common.Anchors = 1+2+4
Panel3.Caption = "Panel 3"
Set Panel4 = SDB.UI.NewGroupBox(Sheet)
Panel4.Common.SetRect 10,185,Sheet.Common.Width -20,50
Panel4.Common.Anchors = 1+2+4
Panel4.Caption = "Panel 4"
End Sub
Sub SaveSheet(Sheet)
End Sub
Re: Groupbox width
Posted: Mon Jan 09, 2017 11:51 am
by Peke
Try with:
Code: Select all
Sub OnStartup
Dim ind
ind = SDB.UI.AddOptionSheet("TestSheet",Script.ScriptPath,"InitSheet","SaveSheet",-2)
End Sub
Sub InitSheet(Sheet)
Dim form, Panel1, Panel2, Panel3, Panel4, PanelWidth
PanelWidth = Sheet.Common.Width -20
Set Panel1 = SDB.UI.NewGroupBox(Sheet)
Panel1.Common.Anchors = 1+2+4
Panel1.Caption = "Panel 1"
Set Panel2 = SDB.UI.NewGroupBox(Sheet)
Panel2.Common.Anchors = 1+2+4
Panel2.Caption = "Panel 2"
Set Panel3 = SDB.UI.NewGroupBox(Sheet)
Panel3.Common.Anchors = 1+2+4
Panel3.Caption = "Panel 3"
Set Panel4 = SDB.UI.NewGroupBox(Sheet)
Panel4.Common.Anchors = 1+2+4
Panel4.Caption = "Panel 4"
PanelWidth = Sheet.Common.Width -20
Panel1.Common.SetRect 10,5,PanelWidth,50
Panel2.Common.SetRect 10,65,PanelWidth ,50
Panel3.Common.SetRect 10,125,PanelWidth,50
Panel4.Common.SetRect 10,185,PanelWidth,50
End Sub
Sub SaveSheet(Sheet)
End Sub
Re: Groupbox width
Posted: Mon Jan 09, 2017 11:57 am
by Peke
But YES there is a BUG first one is not read correctly.
Re: Groupbox width [#13888]
Posted: Mon Jan 09, 2017 12:26 pm
by Peke
Re: Groupbox width [#13888]
Posted: Mon Jan 09, 2017 2:31 pm
by Gingernut63
Re: Groupbox width [#13888]
Posted: Mon Jan 09, 2017 7:31 pm
by Peke
till then use my workaround