I use pinyin input method
It currently handles the mouse and keyboard correctly
But I can't input non English content into the input in HTML
I wonder if someone has solved this problem
Here is my code
local screenWidth, screenHeight
local browser
function onBrowserRender()
dxDrawImage(0, 0, screenWidth, screenHeight, browser, 0, 0, 0, tocolor(255, 255, 255, 255), true)
end
function onBrowserCreated()
loadBrowserURL(browser, "http://mta/local/index.html")
focusBrowser(browser)
addEventHandler("onClientRender", root, onBrowserRender)
addEventHandler("onClientKey", root, onKey)
addEventHandler("onClientCursorMove", root, onCursorMove)
end
addEventHandler("onClientClick", getRootElement(),
function(button, state)
if state == "down" then
injectBrowserMouseDown(browser, button)
else
injectBrowserMouseUp(browser, button)
end
end
)
addEventHandler( "onClientResourceStart", getRootElement(),
function ( startedRes )
screenWidth, screenHeight = guiGetScreenSize()
browser = createBrowser(screenWidth, screenHeight, true, true)
addEventHandler( "onClientBrowserCreated", browser, onBrowserCreated)
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
function onCursorMove(relativeX, relativeY, absoluteX, absoluteY)
injectBrowserMouseMove(browser, absoluteX, absoluteY)
end