SetBrowserRenderingPaused: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(remove note)
 
(10 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client_function}}
{{Client function}}
{{Needs Example}}
{{New feature/item|3.0150|1.5||
{{New feature/item|3.0150|1.5||
This function sets the rendering state of a browser.
This function sets the rendering state of a browser.
}}
}}
{{MessageBox|bordercolorhex=FFB2B2|bgcolorhex=FFE5E5|image=File:Dialog-warning.png|title=Warning:|message=May cause issues with browser rendering on PC with low Ram [https://github.com/multitheftauto/mtasa-blue/issues/1567 #1567]. It's might be better to completely release browser, instead of pausing it, when its not needed.}}


==Syntax==
==Syntax==
Line 10: Line 10:
bool setBrowserRenderingPaused ( browser webBrowser, bool paused )
bool setBrowserRenderingPaused ( browser webBrowser, bool paused )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[sound]]:setRenderingPaused||setBrowserRenderingPaused}}
{{OOP||[[browser]]:setRenderingPaused|renderingPaused|isBrowserRenderingPaused}}


===Required Arguments===
===Required Arguments===
Line 20: Line 20:


==Example==
==Example==
Todo
<syntaxhighlight lang="lua">
--In order to render the browser on the full screen, we need to know the dimensions.
local screenWidth, screenHeight = guiGetScreenSize()
--Let's create a new browser in remote mode.
local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false)
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window)
-- The event onClientBrowserCreated will be triggered, after the browser has been initialized.
-- After this event has been triggered, we will be able to load our URL
local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser
addEventHandler("onClientBrowserCreated", theBrowser,
function()
-- After the browser has been initialized, we can load www.youtube.com
loadBrowserURL(source, "http://www.youtube.com")
end
)
 
 
addCommandHandler ("pause", -- Add command named 'pause'
  function (player, command, value)
      setBrowserRenderingPaused (theBrowser, value)
  end
)
</syntaxhighlight>


==See also==
==See also==
{{CEF_functions}}
{{CEF_functions}}
[[hu:setBrowserRenderingPaused]]
[[RO:setBrowserRenderingPaused]]

Latest revision as of 15:00, 31 May 2021

This function sets the rendering state of a browser.

Dialog-warning.png Warning: May cause issues with browser rendering on PC with low Ram #1567. It's might be better to completely release browser, instead of pausing it, when its not needed.

Syntax

bool setBrowserRenderingPaused ( browser webBrowser, bool paused )

OOP Syntax Help! I don't understand this!

Method: browser:setRenderingPaused(...)
Variable: .renderingPaused
Counterpart: isBrowserRenderingPaused


Required Arguments

  • webBrowser: The browser
  • paused: true to pause rendering, false to continue

Returns

Returns true if the state was successfully changed

Example

--In order to render the browser on the full screen, we need to know the dimensions.
local screenWidth, screenHeight = guiGetScreenSize()
 
--Let's create a new browser in remote mode.
local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false)
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window)
 
-- The event onClientBrowserCreated will be triggered, after the browser has been initialized.
-- After this event has been triggered, we will be able to load our URL
local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser
addEventHandler("onClientBrowserCreated", theBrowser, 
	function()
		-- After the browser has been initialized, we can load www.youtube.com
		loadBrowserURL(source, "http://www.youtube.com")
	end
)


addCommandHandler ("pause", -- Add command named 'pause'
  function (player, command, value)
      setBrowserRenderingPaused (theBrowser, value)
  end
)

See also