I'm currently having and issue with panel docking,
self.panel = vgui.Create("DScrollPanel", self)
self.panel:Dock(FILL)
self.category = vgui.Create("DCollapsibleCategory")
self.category:SetLabel("Jobs")
self.category:Dock(TOP)
self.category:SetExpanded(1)
self.catpanel = vgui.Create("DPanel", self.category)
self.catpanel:Dock(FILL)
self.catlist = vgui.Create("DListLayout", self.catpanel)
self.catlist:Dock(FILL)
self.catlist:DockPadding(3, 3, 3, 7)
...
for k, j in pairs(RPExtraTeams) do
self:SetTall(48)
self.spawnIcon = vgui.Create("SpawnIcon", self)
self.spawnIcon:Dock(LEFT)
self.spawnIcon:SetSize(1, 1)
self.spawnIcon:SetModel(j.model[1])
self.spawnIcon:SizeToContents()
...
self.category:SetContents(self.catlist)
self.panel:AddItem(self.category)
self.catlist:Add(self.spawnIcon)
self.catlist:Add(self.name)
self.catlist:Add(self.description)
self.catlist:Add(self.order)
The category it's under is docked to the top of the page, when I change it to be docked to the left or right, it works correctly
https://gyazo.com/c5dde79da83bbf3fde2a843dcbf5a7cf
I've also tried Panel:AlignLeft() as someone told me to in discord, which didn't work
This is also happening to my become job button, which is supposed to dock to the right and its docking to top
You're docking self.category with TOP instead of FILL.
That didn't work
The only problem that might be causing it is the SizeToContents, try to SetSize the SpawnIcon or use SetTall in combination of Dock(TOP)
That didn't work either
Docking is really retarded, I forget what it was but you need to like reinitialize a panel then resize it or something like that after you call a dock. You can also use http://wiki.garrysmod.com/page/Panel/DockMargin to add space around the edge of a docked panel.
If you want a simple way to stack things by adding items from top to bottom use http://wiki.garrysmod.com/page/Panel/Add
Sorry, you need to Log In to post a reply to this thread.