vgui
The vgui library allows you to script and create your own panels using Valve's Graphical User Interface (VGUI) system.
For an alphabetically ordered list of VGUI panels, see VGUI Element List.
Methods
Creates a panel by the specified classname.
Custom VGUI elements are not loaded instantly. Use GM:OnGamemodeLoaded to create them on startup.
Creates a panel from a table, used alongside vgui. RegisterFile and vgui. RegisterTable to efficiently define, register, and instantiate custom panels.
This is used internally - although you're able to use it you probably shouldn't.
Creates an engine panel.
boolean vgui.CursorVisible()
Returns whenever the cursor is currently active and visible.
Returns true if Lua-defined panel exists by name. Uses vgui. GetControlTable internally.
Returns whether the currently focused panel is a child of the given one.
Returns all Lua-created panels.
Used internally for PANEL:PreAutoRefresh and PANEL:PostAutoRefresh.
Returns the table of a Lua-defined panel by name. Does not return parent members of the table!
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.
Registers a panel for later creation via vgui. Create.
Registers a new VGUI panel from a file, to be used with vgui. CreateFromTable.
File file must use the PANEL global that is provided just before the file is included, for example:
PANEL. Base = "Panel"
function PANEL:Init()
-- Your code. . .
end
function PANEL:Think()
-- Your code. . .
end
Registers a table to use as a panel, to be used with vgui. CreateFromTable.
All this function does is assigns Base key to your table and returns the table.