Pivity

DIconLayout Replacement

Last read Never
#1

Do you hate making grids in DIconLayout because of how annoying it is to use and how nothing ever lines up properly? Well, I made a better grid panel fueled by this hatred. It is based on DScrollPanel, so you don't need to parent it to one, and you can style the vbar directly.


https://github.com/Threebow/better-derma-grid


Example 1

local frame = vgui.Create("DFrame")
frame:SetSize(800, 500)
frame:Center()
frame:MakePopup()

local grid = vgui.Create("ThreeGrid", frame)
grid:Dock(FILL)
grid:DockMargin(4, 4, 4, 4)
grid:InvalidateParent(true)

grid:SetColumns(3)
grid:SetHorizontalMargin(2)
grid:SetVerticalMargin(2)

for i=1, 10 do
local pnl = vgui.Create("DPanel")
pnl:SetTall(100)
grid:AddCell(pnl)
end


Example 2

local grid = vgui.Create("ThreeGrid", frame)
grid:Dock(FILL)
grid:DockMargin(4, 4, 4, 4)
grid:InvalidateParent(true)

grid:SetColumns(3)
grid:SetHorizontalMargin(2)
grid:SetVerticalMargin(2)

for i=1, 10 do
if(i == 4) then grid:SetColumns(4) elseif(i == 9) then grid:SetColumns(2) end

local pnl = vgui.Create("DPanel")
pnl:SetTall(100)
grid:AddCell(pnl)

end

Winner x 5Friendly x 2Dumb x 1
#2

now i can make even better looking derma

Dumb x 2Agree x 1
#3
ByAnthony Fullerat 30th of August 2018 23:20:01
now i can make even better looking derma

D E S I G N A G N O S T I C

its just to make positioning, etc. easier and less repetitive, so you can focus on making your design good without worrying about cancer setpos and setsize

#6

I seem to be having an issue that It only works when parenting the grid to a DFrame, whenever I parent it to a DPanel, the cells dont stretch across the panel. Looks like this: https://gyazo.com/76d38c34495943f5a08394e46faafc2f

#7
ByBrick Wallat 5th of September 2018 20:57:53
I seem to be having an issue that It only works when parenting the grid to a DFrame, whenever I parent it to a DPanel, the cells dont stretch across the panel.Looks like this: https://gyazo.com/76d38c34495943f5a08394e46faafc2f

The panel doesn't have the proper size when you're adding the items, if its docked then call :InvalidateParent(true), I'll fix it soon either way

Users viewing this thread
Nobody