Gamemode.VGUIMousePressed

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameVGUIMousePressed
SyntaxGM:VGUIMousePressed( Panel Clicked, MouseCode Pressed )
DescriptionCalled when a panel is clicked.
ReturnsNil
Lua StateNewerClient.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.VGUIMousePressed]Gamemode.VGUIMousePressed [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionFrom gmod's code, used by DTextEntry to lose it's keyboard focus when another panel is clicked.
Used onNewerClient.png
Code
function TextEntryLoseFocus( panel, mcode )
 
    local pnl = vgui.GetKeyboardFocus()
    if ( !pnl ) then return end
    if ( pnl == panel ) then return end
    if ( !pnl.m_bLoseFocusOnClickAway ) then return end
 
    pnl:FocusNext()
 
end
 
hook.Add( "VGUIMousePressed", "TextEntryLoseFocus", TextEntryLoseFocus )
OutputN/A
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox