IsBrowserFocused: Difference between revisions
Jump to navigation
Jump to search
m (localPlayer is a predefined variable) |
|||
Line 19: | Line 19: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local theBrowser = guiCreateBrowser ( 150, 150, 1280, 720, true, false, false) | local theBrowser = guiCreateBrowser ( 150, 150, 1280, 720, true, false, false) | ||
addEventHandler("onClientKey", | addEventHandler("onClientKey", localPlayer, function(button, state) -- adds the event handler. | ||
if button == "lctrl" and state = "down" then -- if the pressed key is lctrl and the state is down then we will check is the browser focused or not. | if button == "lctrl" and state = "down" then -- if the pressed key is lctrl and the state is down then we will check is the browser focused or not. | ||
if isBrowserFocused(theBrowser) then | if isBrowserFocused(theBrowser) then |
Revision as of 04:16, 17 April 2017
Script Example Missing Function IsBrowserFocused needs a script example, help out by writing one. | |
Before submitting check out Editing Guidelines Script Examples. |
This function checks if a browser is focused.
Syntax
bool isBrowserFocused ( browser webBrowser )
OOP Syntax Help! I don't understand this!
- Method: browser:isFocused(...)
Required arguments
- webBrowser: The browser
Returns
Returns true if the browser is focused, false otherwise and nil if invalid arguments were passed.
Example
local theBrowser = guiCreateBrowser ( 150, 150, 1280, 720, true, false, false) addEventHandler("onClientKey", localPlayer, function(button, state) -- adds the event handler. if button == "lctrl" and state = "down" then -- if the pressed key is lctrl and the state is down then we will check is the browser focused or not. if isBrowserFocused(theBrowser) then outputChatbox("the browser is focused.") -- if the browser is focused then we will write this to chatbox. else outputChatbox("the browser is not focused.")-- if the browser is not focused then we will write this to chatbox. end end end)
See Also
- canBrowserNavigateBack
- canBrowserNavigateForward
- createBrowser
- executeBrowserJavascript
- focusBrowser
- getBrowserProperty
- getBrowserSettings
- getBrowserSource
- getBrowserTitle
- getBrowserURL
- injectBrowserMouseDown
- injectBrowserMouseMove
- injectBrowserMouseUp
- injectBrowserMouseWheel
- isBrowserDomainBlocked
- isBrowserFocused
- isBrowserLoading
- isBrowserRenderingPaused
- loadBrowserURL
- navigateBrowserBack
- navigateBrowserForward
- reloadBrowserPage
- requestBrowserDomains
- resizeBrowser
- setBrowserAjaxHandler
- setBrowserProperty
- setBrowserRenderingPaused
- setBrowserVolume
- toggleBrowserDevTools