MatrixGene Posted December 27, 2021 Share Posted December 27, 2021 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 Link to comment
Scripting Moderators thisdp Posted December 27, 2021 Scripting Moderators Share Posted December 27, 2021 Because MTA doesn't handle Input Method for CEF. Link to comment
MatrixGene Posted December 27, 2021 Author Share Posted December 27, 2021 12 minutes ago, thisdp said: Because MTA doesn't handle Input Method for CEF. Have you tried guiCreateBrowser? Of course, now I have a solution, which is to still use CEGUI to process text input Link to comment
Scripting Moderators thisdp Posted December 27, 2021 Scripting Moderators Share Posted December 27, 2021 2 hours ago, MatrixGene said: Have you tried guiCreateBrowser? Of course, now I have a solution, which is to still use CEGUI to process text input Well, CEF with CEGUI also doesn't handle input method. Link to comment
The_GTA Posted December 27, 2021 Share Posted December 27, 2021 1 hour ago, thisdp said: Well, CEF with CEGUI also doesn't handle input method. Wouldn't it be a security hazard if it did? After all authentications could be performed on remote web pages. Link to comment
Scripting Moderators thisdp Posted December 27, 2021 Scripting Moderators Share Posted December 27, 2021 (edited) 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 December 27, 2021 by thisdp Link to comment
Nurupo Posted December 30, 2021 Share Posted December 30, 2021 I'm wondering would be possible if you just using a javascript based IME on your ui? i know there are serveral web-based ime projects are there, like web-pinyin-ime, maybe worth a try, good luck Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now