InjectBrowserMouseWheel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 22: Line 22:
<syntaxhighlight lang="lua">local webBrowser = createBrowser(1000, 1000, false, false)
<syntaxhighlight lang="lua">local webBrowser = createBrowser(1000, 1000, false, false)
showCursor(true)
showCursor(true)
function webBrowserRender()
function webBrowserRender()
            dxDrawImage(0, 0, 1000, 1000, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true)
        dxDrawImage(0, 0, 1000, 1000, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true)
end
end
  addEventHandler("onClientBrowserCreated", webBrowser,
 
addEventHandler("onClientBrowserCreated", webBrowser,
         function()
         function()
               loadBrowserURL(webBrowser, "https://www.youtube.com/tv#/watch?mode=transport&v=jofNR_WkoCE")
               loadBrowserURL(webBrowser, "https://www.youtube.com/tv#/watch?mode=transport&v=jofNR_WkoCE")

Revision as of 00:28, 18 April 2015

This function injects mouse wheel events.

Syntax

bool injectBrowserMouseWheel ( browser webBrowser, int verticalScroll, int horizontalScroll )

OOP Syntax Help! I don't understand this!

Method: browser:injectMouseWheel(...)
Counterpart: injectBrowserMouseWheel


Required arguments

  • webBrowser: The web browser
  • verticalScroll: Amount of units you want the browser to scroll along the Y-axe.
  • horizontalScroll: Amount of units you want the browser to scroll along the X-axe.

Returns

Returns true if the mouse action was successfully injected, false otherwise.

Example

local webBrowser = createBrowser(1000, 1000, false, false)
showCursor(true)

function webBrowserRender()
        dxDrawImage(0, 0, 1000, 1000, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true)
end

addEventHandler("onClientBrowserCreated", webBrowser,
        function()
              loadBrowserURL(webBrowser, "https://www.youtube.com/tv#/watch?mode=transport&v=jofNR_WkoCE")
              addEventHandler("onClientRender", root, webBrowserRender)
              addEventHandler("onClientKey", root, onKey)
	end
)

function onKey(button)
	if button == "mouse_wheel_down" then
		injectBrowserMouseWheel(webbrowser, -40, 0)
	else
		injectBrowserMouseWheel(webbrowser, 40, 0)
	end
end

See Also

Todo

See also