Garry's Mod Wiki

DListBox

Description

We advise against using this. It may be changed or removed in a future update. Derived from the deprecated DPanelList.

A simple list box with optional multi-select.
As this is deprecated, it is recommended that you use DListView, which contains the same functionality with multi-column options.

View source

Parent

Derives methods, etc not listed on this page from DPanelList.

Implements

Implements or overrides the following hooks/methods. If you want to override these, you probably want to call the original function too.

Methods

boolean DListBox:GetMultiple()
Returns whether the list box can select multiple items.
Returns selected items.
Returns selected item values.
DListBox:SelectByName( string val )
Select a DListBoxItem based on its value.
DListBox:SelectItem( Panel item, boolean onlyme )
This is used internally - although you're able to use it you probably shouldn't. Used internally to select a specific panel.
DListBox:SetMultiple( boolean multiple )
Sets whether the list box can select multiple items.
DListBox:SetSelectedItems( table items )
This is used internally - although you're able to use it you probably shouldn't. Sets selected items.

Example

local DFrame = vgui.Create( "DFrame" ) DFrame:SetPos( 100, 100 ) DFrame:SetSize( 300, 200 ) DFrame:SetTitle( "Derma Frame" ) DFrame:MakePopup() local DListBox = vgui.Create( "DListBox", DFrame ) DListBox:Dock( FILL ) DListBox:AddItem( "test1" ) DListBox:AddItem( "test2" ) DListBox:AddItem( "test3" ) DListBox:SetMultiple( true )