Garry's Mod Wiki


The vgui library allows you to script and create your own panels using Valve's GUI system.
For an alphabetically ordered list of VGUI panels, see VGUI Element List.


Panel vgui.Create( string classname, Panel parent = nil, string name = "nil" )
Creates a panel by the specified classname. Custom VGUI elements are not loaded instantly. Use GM:OnGamemodeLoaded to create them on startup.
Panel vgui.CreateFromTable( table metatable, Panel parent = nil, string name = "nil" )
Creates a panel from table.
Panel vgui.CreateX( string class, Panel parent = nil, string name = "nil" )
This is used internally - although you're able to use it you probably shouldn't. Creates a engine panel.
boolean vgui.CursorVisible()
Returns whenever the cursor is currently active and visible.
boolean vgui.FocusedHasParent( Panel parent )
Returns whether the currently focused panel is a child of the given one.
table vgui.GetControlTable( string Panelname )
Gets the method table of this panel. Does not return parent methods!
Panel vgui.GetHoveredPanel()
Returns the panel the cursor is hovering above. This returns a cached value that is only updated after rendering and before the next VGUI Think/Layout pass. ie. it lags one frame behind panel layout and is completely unhelpful for PANEL:Paint if your panels are moving around under the mouse a lot every frame.
Panel vgui.GetKeyboardFocus()
Returns the panel which is currently receiving keyboard input.
Panel vgui.GetWorldPanel()
Returns the global world panel which is the parent to all others, except for the HUD panel. See also GetHUDPanel.
boolean vgui.IsHoveringWorld()
Returns whenever the cursor is hovering the world panel.
table vgui.Register( string classname, table panelTable, string baseName = "Panel" )
Registers a panel for later creation.
table vgui.RegisterFile( string file )
Registers a new VGUI panel from a file.
table vgui.RegisterTable( table panel, string base = "Panel" )
Registers a table to use as a panel. All this function does is assigns Base key to your table and returns the table.

Page Links

Special Pages



Render Time: 42ms

DB GetPage 6
Generate Html 5
SaveChanges (1) 13
Render Body 0
Render Sidebar 15