From 6088ae913b17be4804d4efe313b1218f475251d0 Mon Sep 17 00:00:00 2001 From: Arthur Geron Date: Mon, 1 Apr 2019 03:55:23 -0300 Subject: [PATCH] Added DGrid inside DScrollPanel --- .../gamemode/inventory/client/cl_inventory.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gamemodes/zombiesurvival/gamemode/inventory/client/cl_inventory.lua b/gamemodes/zombiesurvival/gamemode/inventory/client/cl_inventory.lua index 7646a24..89dcdd3 100644 --- a/gamemodes/zombiesurvival/gamemode/inventory/client/cl_inventory.lua +++ b/gamemodes/zombiesurvival/gamemode/inventory/client/cl_inventory.lua @@ -352,13 +352,18 @@ function GM:OpenInventory() topspace:AlignTop(8) topspace:CenterHorizontal() - local invgrid = vgui.Create("DGrid", frame) - invgrid:SetSize(wid - 16 * screenscale, frame:GetTall() - 8 - topspace:GetTall()) - invgrid:MoveBelow(topspace, 16) + local invListPanel = vgui.Create("DScrollPanel", frame) + invListPanel:Dock( FILL ) + local sbar = invListPanel:GetVBar() + sbar.Enabled = true + invListPanel:DockMargin(0, topspace:GetTall() + 8, 0, 0) + invListPanel:InvalidateParent(true) + + local invgrid = vgui.Create("DGrid", invListPanel) + invgrid:SetSize(invListPanel:GetWide() - sbar:GetWide(), invListPanel:GetTall()) invgrid:SetCols(5) invgrid:SetColWide((70 + (invgrid:GetWide() - 70*5) / 4) * screenscale) invgrid:SetRowHeight(70 * screenscale) - invgrid:CenterHorizontal() frame.Grid = invgrid for item, count in pairs(self.ZSInventory) do