onClientGUIFocus
Client-side
Server-side
Shared
This event is triggered each time a GUI element gains input focus (mainly useful for windows, editboxes and memos but triggered for all GUI elements nevertheless).
Parameters
This event does not pass any parameters to the handler function.
Source
element: The source of this event is the GUI element which just gained input focus.
Code Examples
client
local window, editbox = nil, niladdCommandHandler("example",function() local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 263, 90 local left = screenWidth/2 - windowWidth/2 local top = screenHeight/2 - windowHeight/2 window = guiCreateWindow(left, top, windowWidth, windowHeight, "Example Window", false) editbox = guiCreateEdit(11, 41, 241, 22, "", false, window) addEventHandler("onClientGUIFocus", editbox, onClientGUIFocus_editbox, true) --true because for the example we want propagated events addEventHandler("onClientGUIBlur", editbox, onClientGUIBlur_editbox, true) --true because for the example we want propagated events showCursor(true)end)
function onClientGUIFocus_editbox() if source == editbox then outputChatBox("Example editBox received input focus") elseif source == window then outputChatBox("Example window received input focus") endend
function onClientGUIBlur_editbox() if source == editbox then outputChatBox("Example editBox lost input focus") elseif source == window then outputChatBox("Example window lost input focus") endend
See Also
Input Events
- onClientCharacter
- onClientClick
- onClientCursorMove
- onClientDoubleClick
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIFocus
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientKey
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel
- onClientPaste
Input Functions
- addCommandHandler
- bindKey
- executeCommandHandler
- getCommandHandlers
- getFunctionsBoundToKey
- getKeyBoundToFunction
- isControlEnabled
- removeCommandHandler
- toggleAllControls
- toggleControl
- unbindKey
- getAnalogControlState
- getCommandsBoundToKey
- getBoundKeys
- getKeyBoundToCommand
- getKeyState
- isCapsLockEnabled
- setAnalogControlState
- isKeyBound