SetWebFocus

From Onset Developer Wiki
Revision as of 14:04, 11 February 2021 by BlueMountains (talk | contribs) (Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|Sets (keyboard) focus to a WebUI. Useful for custom chats. After calling this function you should also focus the HTML input el...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
SetWebFocus

Type: Function
Context: Client
Introduced: v1.0

Description

Sets (keyboard) focus to a WebUI. Useful for custom chats.

After calling this function you should also focus the HTML input element in javascript. https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus

Syntax

SetWebFocus(web)

Parameters

  • web
    The web identifier

Return Value

  • This function returns true on success.

Example

	if key == "Space Bar" then
		if IsCtrlPressed() then
			AddPlayerChat("Focus mapeditor")
			SetWebFocus(EditorGui)
			ExecuteWebJS(EditorGui, "FocusInput();")
		end
	end

See also