ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. focusBrowser

Function

focusBrowser

Gives the keyboard to a browser. Typing goes to the page when one of its text fields is active and the cursor is shown. nil removes focus from all browsers.

Syntax

bool focusBrowser(browser webBrowser)

Arguments

webBrowserbrowser
A browser or nil.Optional in MTA:SA: browser webBrowser = nil

Differences from MTA:SA

  • Arguments in a different colour differ from MTA:SA.

In MTA:SA

focusBrowser(browser webBrowser = nil)

Returns

true on success.

Example

showCursor(true)
focusBrowser(browser)

Notes

When to call it. Right after createBrowser is fine - the focus stays with the browser while the page loads. The keyboard reaches the page when: the browser has focusBrowser, the cursor is visible (showCursor(true)) and a text field on the page is active (onClientBrowserInputFocusChanged(true)). Keys then go neither to the game nor to binds; guiSetInputEnabled is not needed. A movement key held while a panel opens does not get stuck - the release always reaches the game.

See also