Garry's Mod Wiki

DIconBrowser

Description

Simply a DIconLayout which automatically displays all of the Silkicons. Used as a way to get the user to select an icon.

View source

Parent

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

Methods

DIconBrowser:Fill()
This is used internally - although you're able to use it you probably shouldn't. Automatically called to fill the browser with icons. Will not work if DIconBrowser:SetManual is set to true.
DIconBrowser:FilterByText( string text )
A simple unused search feature, hides all icons that do not contain given text in their file path.
boolean DIconBrowser:GetManual()
Returns whether or not the browser should fill itself with icons.
string DIconBrowser:GetSelectedIcon()
Returns the currently selected icon's file path.
DIconBrowser:OnChange()
Called when the selected icon was changed. Use DIconBrowser:GetSelectedIcon to get the selected icon's filepath.
DIconBrowser:OnChangeInternal()
This is used internally - although you're able to use it you probably shouldn't. Use DIconBrowser:OnChange instead
DIconBrowser:ScrollToSelected()
Scrolls the browser to the selected icon
DIconBrowser:SelectIcon( string icon )
Selects an icon from file path
DIconBrowser:SetManual( boolean manual )
Sets whether or not the browser should automatically fill itself with icons.
DIconBrowser:SetSelectedIcon( string str )
This is used internally - although you're able to use it you probably shouldn't. Set the currently selected file path. Do not use. Use DIconBrowser:SelectIcon instead.

Example

Creates a DIconBrowser which, when an icon is clicked, prints said icon's directory.

local DermaPanel = vgui.Create("DFrame") DermaPanel:SetSize(300, 200) DermaPanel:Center() DermaPanel:SetTitle("DIconBrowserExample") DermaPanel:MakePopup() local IconBrowser = DermaPanel:Add("DIconBrowser") IconBrowser:Dock(FILL) IconBrowser.OnChange = function(self) chat.AddText("You selected: " .. self:GetSelectedIcon()) end