IsBrowserRenderingPaused: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(remove note)
(Remove obsolete Requirements section)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
{{New feature/item|3.0150|1.5||
{{Added feature/item|1.5.9|1.5.8|20806|This function gets the rendering state of a [[browser]] [[element]].}}
This function gets the rendering state of a browser.
}}


==Syntax==
==Syntax==
Line 12: Line 10:


===Required Arguments===
===Required Arguments===
*'''webBrowser:''' The browser
*'''webBrowser:''' The [[browser]] [[element]] to get the rendering state of.


===Returns===
===Returns===
Returns the browser rendering paused state.
Returns ''true'' if the browser rendering is paused, ''false'' otherwise.


==Example==
==Example==
This will create a [[browser]] [[element]] and a command to pause the browser rendering:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--In order to render the browser on the full screen, we need to know the dimensions.
-- In order to render the browser on the full screen, we need to know the dimensions.
local screenWidth, screenHeight = guiGetScreenSize()
local screenWidth, screenHeight = guiGetScreenSize ()
   
   
--Let's create a new browser in remote mode.
-- Let's create a new browser in remote mode.
local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false)
local window = guiCreateWindow (0, 0, screenWidth, screenHeight, "Webbrowser", false)
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window)
local browser = guiCreateBrowser (0, 0, 800, 600, false, false, false, window)
   
   
-- The event onClientBrowserCreated will be triggered, after the browser has been initialized.
-- 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
-- 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
local theBrowser = guiGetBrowser (browser) -- Get the browser element from gui-browser
addEventHandler("onClientBrowserCreated", theBrowser,  
addEventHandler ("onClientBrowserCreated", theBrowser,  
function()
    function ()
-- After the browser has been initialized, we can load www.youtube.com
-- After the browser has been initialized, we can load www.youtube.com
loadBrowserURL(source, "http://www.youtube.com")
loadBrowserURL (source, "http://www.youtube.com")
end
end
)
)


 
addCommandHandler ("pause", -- Add a command named 'pause'
addCommandHandler ("pause", -- Add command named 'pause'
   function (player, commandName)
   function (player, command)
       if isBrowserRenderingPaused (theBrowser) then
       if isBrowserRenderingPaused(theBrowser) then
           setBrowserRenderingPaused (theBrowser, false)
           setBrowserRenderingPaused (theBrowser, false)
       else
       else
Line 50: Line 48:
==See also==
==See also==
{{CEF_functions}}
{{CEF_functions}}
[[hu:setBrowserRenderingPaused]]
[[RO:setBrowserRenderingPaused]]

Latest revision as of 17:24, 7 November 2024

This function gets the rendering state of a browser element.

Syntax

bool isBrowserRenderingPaused ( browser webBrowser )

OOP Syntax Help! I don't understand this!

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


Required Arguments

Returns

Returns true if the browser rendering is paused, false otherwise.

Example

This will create a browser element and a command to pause the browser rendering:

-- 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 a command named 'pause'
  function (player, commandName)
      if isBrowserRenderingPaused (theBrowser) then
          setBrowserRenderingPaused (theBrowser, false)
      else
          setBrowserRenderingPaused (theBrowser, true)
      end
  end
)

See also