OnClientMTAFocusChange: Difference between revisions
Jump to navigation
Jump to search
(Add onClientMTAFocusChange by lopsi & CrosRoad95 (https://github.com/multitheftauto/mtasa-blue/pull/2371)) |
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client event}} | {{Client event}} | ||
{{New feature/item|3.0160|1.5.9|21313| This event is triggered every time MTA gains or | {{New feature/item|3.0160|1.5.9|21313| This event is triggered every time the MTA window gains or loses focus.}} | ||
==Parameters== | ==Parameters== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool windowFocused | |||
</syntaxhighlight> | </syntaxhighlight> | ||
*'''windowFocused:''' A [[boolean]], indicating whether MTA is focused or not. | *'''windowFocused:''' A [[boolean]], indicating whether the MTA window is focused or not. | ||
==Source== | ==Source== | ||
Line 22: | Line 22: | ||
addEventHandler("onClientMTAFocusChange", root, onClientMTAFocusChange) | addEventHandler("onClientMTAFocusChange", root, onClientMTAFocusChange) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== |
Latest revision as of 17:33, 7 November 2024
This event is triggered every time the MTA window gains or loses focus.
Parameters
bool windowFocused
- windowFocused: A boolean, indicating whether the MTA window is focused or not.
Source
The source of this event is the root element.
Example
This example prints message on chat with focus state:
function onClientMTAFocusChange(windowFocused) local focusedText = windowFocused and "MTA has gained focus." or "MTA has lost focus." outputChatBox(focusedText) end addEventHandler("onClientMTAFocusChange", root, onClientMTAFocusChange)
See Also
Client other events
- onClientChatMessage
- onClientConsole
- onClientDebugMessage
- onClientExplosion
- onClientFileDownloadComplete
- onClientHUDRender
- onClientMinimize
- onClientMTAFocusChange
- onClientPedsProcessed
- onClientPlayerNetworkStatus
- onClientPreRender
- onClientRender
- onClientRestore
- onClientTransferBoxProgressChange
- onClientTransferBoxVisibilityChange
- onClientWorldSound
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled