IsBrowserRenderingPaused: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} {{New feature/item|3.0150|1.5|| This function gets the rendering state of a browser. }} ==Syntax== <syntaxhighlight lang="lua"> bool isBrowserRe...")
 
(remove note)
Line 9: Line 9:
bool isBrowserRenderingPaused ( browser webBrowser )
bool isBrowserRenderingPaused ( browser webBrowser )
</syntaxhighlight>
</syntaxhighlight>
{{OOP|As of MTA: SA {{Current Version|master}} the counterpart is not implemented yet.|[[browser]]:isRenderingPaused|renderingPaused|setBrowserRenderingPaused}}
{{OOP||[[browser]]:isRenderingPaused|renderingPaused|setBrowserRenderingPaused}}


===Required Arguments===
===Required Arguments===

Revision as of 14:59, 31 May 2021

This function gets the rendering state of a browser.

Syntax

bool isBrowserRenderingPaused ( browser webBrowser )

OOP Syntax Help! I don't understand this!

Method: browser:isRenderingPaused(...)
Variable: .renderingPaused
Counterpart: setBrowserRenderingPaused


Required Arguments

  • webBrowser: The browser

Returns

Returns the browser rendering paused state.

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)
      if isBrowserRenderingPaused(theBrowser) then
          setBrowserRenderingPaused (theBrowser, false)
      else
          setBrowserRenderingPaused (theBrowser, true)
      end
  end
)

See also