Seeroy Posted April 25, 2023 Share Posted April 25, 2023 Hello. I have a problem with my CEF, my interface is not clickable. Input with keyboard working, but clicks not working. My code in onClientRender if (browserVisible == true) then dbw = dxDrawImage(posX, posY, windowWidth, windowHeight, webBrowser, 0, 0, 0, tocolor(255, 255, 255, 245), true) focusBrowser(webBrowser) end Browser showing code if (getPedOccupiedVehicleSeat(localPlayer) == 0) then browserVisible = true showCursor(true) guiSetInputEnabled(true) showChat(false) focusBrowser(webBrowser) end This is my onClientBrowserCreated code addEventHandler("onClientBrowserCreated", webBrowser, function() loadBrowserURL(webBrowser, url) addEventHandler("onClientKey", getRootElement(), function(button) if button == "mouse_wheel_down" then injectBrowserMouseWheel(webBrowser, -40, 0) elseif button == "mouse_wheel_up" then injectBrowserMouseWheel(webBrowser, 40, 0) end end) addEventHandler("onClientClick", getRootElement(), function(button, state) if state == "down" then injectBrowserMouseDown(webBrowser, button) else injectBrowserMouseUp(webBrowser, button) end end) addEventHandler("onClientCursorMove", getRootElement(), function(relativeX, relativeY, absoluteX, absoluteY) injectBrowserMouseMove(webBrowser, absoluteX, absoluteY) end) end) Link to comment
FLUSHBICEPS Posted April 25, 2023 Share Posted April 25, 2023 addEventHandler("onClientCursorMove", getRootElement(), function(relativeX, relativeY, absoluteX, absoluteY) local browserX, browserY = absoluteX - posX, absoluteY - posY injectBrowserMouseMove(webBrowser, browserX, browserY) end) Link to comment
Doongogar Posted April 25, 2023 Share Posted April 25, 2023 4 hours ago, Seeroy said: addEventHandler("onClientClick", getRootElement(), function(button, state) if button == "left" and state == "down" then injectBrowserMouseDown(webBrowser, button) else injectBrowserMouseUp(webBrowser, button) end end) here you are determining the state of the clicked button, but you are not determining which button clicked will perform the action, you have 3 click options (right, left and middle) here's an example with the left button: addEventHandler("onClientClick", getRootElement(), function(button, state) if button == "left" and state == "down" then injectBrowserMouseDown(webBrowser, button) else injectBrowserMouseUp(webBrowser, button) end end) Link to comment
Seeroy Posted April 26, 2023 Author Share Posted April 26, 2023 20 hours ago, FLUSHBICEPS said: addEventHandler("onClientCursorMove", getRootElement(), function(relativeX, relativeY, absoluteX, absoluteY) local browserX, browserY = absoluteX - posX, absoluteY - posY injectBrowserMouseMove(webBrowser, browserX, browserY) end) Thank you, it works 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