InjectBrowserMouseWheel: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (Link to the Romanian translation of this page added.) |
||
(10 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{ | {{Client function}} | ||
This function injects mouse | {{New feature/item|3.0150|1.5|| | ||
This function injects mouse wheel events. | |||
}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool | bool injectBrowserMouseWheel ( browser webBrowser, int verticalScroll, int horizontalScroll ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[Element/Browser|browser]]:injectMouseWheel||injectBrowserMouseWheel}} | |||
===Required arguments=== | ===Required arguments=== | ||
Line 17: | Line 20: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua">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) | |||
elseif button == "mouse_wheel_up" then | |||
injectBrowserMouseWheel(webBrowser, 40, 0) | |||
end | |||
end</syntaxhighlight> | |||
==See also== | ==See also== | ||
{{CEF_functions}} | {{CEF_functions}} | ||
[[hu:injectBrowserMouseWheel]] | |||
[[RO:injectBrowserMouseWheel]] |
Latest revision as of 12:28, 8 April 2020
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) elseif button == "mouse_wheel_up" then injectBrowserMouseWheel(webBrowser, 40, 0) end end
See also
- canBrowserNavigateBack
- canBrowserNavigateForward
- createBrowser
- executeBrowserJavascript
- focusBrowser
- getBrowserProperty
- getBrowserSettings
- getBrowserSource
- getBrowserTitle
- getBrowserURL
- injectBrowserMouseDown
- injectBrowserMouseMove
- injectBrowserMouseUp
- injectBrowserMouseWheel
- isBrowserDomainBlocked
- isBrowserFocused
- isBrowserLoading
- isBrowserRenderingPaused
- loadBrowserURL
- navigateBrowserBack
- navigateBrowserForward
- reloadBrowserPage
- requestBrowserDomains
- resizeBrowser
- setBrowserAjaxHandler
- setBrowserProperty
- setBrowserRenderingPaused
- setBrowserVolume
- toggleBrowserDevTools