Panel.RequestFocus

From GMod Wiki

Jump to: navigation, search
Function
Syntax Panel:RequestFocus( )
Description:
Attempts to obtain the focus for this panel.
Returns: nil
In Object: Panel
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Panel.RequestFocus]Panel.RequestFocus [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionIf the panel p has the focus, then it remove the focus. If it doesn't have the focus, it requests it.
Used onNewerClient.png
Code
// P = a Panel object
if (P:HasFocus()) then
    Msg("P has the focus!\n")
    P:KillFocus()
else
   Msg("Requesting focus!\n")
   P:RequestFocus()
end
OutputN/A


Note that if you are releasing an object with Panel.KillFocus you should add a delay before requesting focus on another object or it will fail silently.

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox