GuiGetBrowser: 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 creates gets the browser element behind a gui-browser (a browser that has been created via guiCre...")
 
Line 17: Line 17:


==Example==
==Example==
See [[guiCreateBrowser]]
This examples get's browser element from gui-browser and attach a webbrowser to a CEGUI window.
<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(200, 200, 1024, 768, "Webbrowser", false)
local browser = guiCreateBrowser(0, 0, 800, 600, 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
)
</syntaxhighlight>


==See Also==
==See Also==
{{GUI_functions}}
{{GUI_functions}}

Revision as of 19:01, 12 April 2015

This function creates gets the browser element behind a gui-browser (a browser that has been created via guiCreateBrowser).

Syntax

browser guiGetBrowser ( gui-browser theBrowser )

OOP Syntax Help! I don't understand this!

Method: GuiBrowser.getBrowser(...)
Counterpart: guiGetBrowser


Required Arguments

  • theBrowser The gui-browser

Returns

Returns the Element/browser element if a correct Element/gui-browser has been passed, false otherwise.

Example

This examples get's browser element from gui-browser and attach a webbrowser to a CEGUI window.

--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(200, 200, 1024, 768, "Webbrowser", false)
local browser = guiCreateBrowser(0, 0, 800, 600, 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
)

See Also

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows