Garry's Mod Wiki

Garry's Mod Wiki

  DPanelList:SetAutoSize( boolean shouldSizeToContents )

Description

Sets the DPanelList to size its height to its contents. This is set to false by default.

Arguments

1 boolean shouldSizeToContents
Whether to size to the height of the DPanelList contents.

Example

Creates a list with buttons, auto sizes the list to the buttons

local panelList = vgui.Create("DPanelList", self) panelList:SetAutoSize(true) for i = 1, 5 do local button = vgui.Create("DButton", self) button:SetText("Button " .. i) panelList:AddItem(button) end -- Ensure PerformLayout is called (which sets the list height to the content height) panelList:InvalidateLayout()
Output:
list-of-buttons.png

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...