Jump to content

dx browser does not respond to input method


MatrixGene

Recommended Posts

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

spacer.png

 

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

 

Link to comment
  • Scripting Moderators
34 minutes ago, The_GTA said:

Wouldn't it be a security hazard if it did? After all authentications could be performed on remote web pages.

It is too secure to prevent user from inputing... 

34 minutes ago, The_GTA said:

Wouldn't it be a security hazard if it did? After all authentications could be performed on remote web pages.

The problem that @MatrixGene mentioned is we can't input Chinese Characters into CEF. What we need is an input method handler just like guiEdit.

Edited by thisdp
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...