OnClientMTAFocusChange: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Fix typo.)
mNo edit summary
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 loses focus.}}
{{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">
boolean windowFocused
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==

Revision as of 14:58, 8 October 2022

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)

Requirements

This template will be deleted.

See Also

Client other events


Client event functions