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.

Parent

Derives 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:SetPos( 100, 100 ) DermaPanel:SetSize( 300, 200 ) DermaPanel:SetTitle( "DIconBrowserExample" ) DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( true ) DermaPanel:ShowCloseButton( true ) DermaPanel:MakePopup() local IconBrowser = vgui.Create( "DIconBrowser", DermaPanel ) IconBrowser:SetPos( 5, 30 ) IconBrowser:SetSize( 290, 265 ) IconBrowser.OnChange = function(self) chat.AddText( "You selected: " .. self:GetSelectedIcon()) end

Page Links


Special Pages


Wikis

?

Render Time: 92ms

DB GetPage 47
Generate Html 11
SaveChanges (1) 17
Render Body 0
Render Sidebar 15