Garry's Mod Wiki

Revision Difference

DIconBrowser#527426

<panel> <name>DIconBrowser</name> <parent>DScrollPanel</parent> <description>Simply a <page text="DIconLayout">VGUI/Elements/DIconLayout</page> which automatically displays all of the <page text="Silkicons">silkicons</page>. Used as a way to get the user to select an icon.</description> <description>Simply a <page>DIconLayout</page> which automatically displays all of the <page text="Silkicons">silkicons</page>. Used as a way to get the user to select an icon.</description> </panel> <example> <description>Creates a DIconBrowser which, when an icon is clicked, prints said icon's directory.</description> <code> 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 </code> </example>