Special keys not working

Having problems with building or using the JCEF Java binding? Ask your questions here.

Special keys not working

Postby gteijido » Wed Nov 28, 2018 4:12 pm

Hi all,

I´m having the exact same problem described in viewtopic.php?f=6&t=11001 but just using JavaFX (java 8).

Basically, the special keys (enter, tab, arrows, shift, ctrl, etc) do not work. As an example, If I browse Google, enter something in the text input and press enter, it won´t do anything while it should submit the form.

I was wondering if someone here can point me on the right direction to solve this in JCEF.

Thank you very much in advance
gteijido
Newbie
 
Posts: 5
Joined: Fri Nov 16, 2018 5:07 pm

Re: Special keys not working

Postby magreenblatt » Wed Nov 28, 2018 4:20 pm

What OS and CEF version? Are you using windowed or off-screen rendering?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Special keys not working

Postby gteijido » Thu Nov 29, 2018 1:33 pm

Thank you magreenblatt for asking. I´ve downloaded the cef_binary_3.3538.1849.g458cc98_windows64_client.tar.bz2 and compiled it locally for Windows 10 64bits and it´s windowed.
gteijido
Newbie
 
Posts: 5
Joined: Fri Nov 16, 2018 5:07 pm

Re: Special keys not working

Postby magreenblatt » Thu Nov 29, 2018 1:49 pm

I'm not able to reproduce this problem using a 64-bit build of JCEF master with CEF version 3.3538.1852 on Windows 10. My Windows version is English language with a US keyboard. Are you using a different language or keyboard layout?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Special keys not working

Postby gteijido » Thu Nov 29, 2018 2:57 pm

Same as you. Windows in english and english layout for the keyboard. Here is the code (based on a very basic example I found online) of the main class:

Code: Select all
public class Main extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception{

        /* * Gets the cef application singleton. It loads all resources
         * (native libraries etc.), initializes app...
         */
        final CefApp cefApp = CefApp.getInstance();
        /*
         * You can create many browser instances per cef app (e.g.
         * used as browser tabs) Responsible for handling all
         * events from the browser instances.
         */
        final CefClient client = cefApp.createClient();
        /*
         * Browser instances are responsible for rendering of
         * the browser's content.
         */
        //final CefBrowser browser = client.createBrowser( PropertiesService.getInstance().getValue("WEB_LOGIN_URL"), OS.isWindows(), false);
        final CefBrowser browser = client.createBrowser( "http://www.google.com/", OS.isWindows(), false);
        /*
         * Returns the browser's ui component used for
         * rendering in a awt application
         */
        final Component browserUI = browser.getUIComponent();
        // Create a new frame for holding the browser ui
        final JFrame mainFrame = new JFrame();
        // Add the browser ui to this newly created frame
        mainFrame.getContentPane().add(browserUI, BorderLayout.CENTER);
        // Show frame
        mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
        mainFrame.setVisible(true);

        /*
         * Attach a handler to close the jcef application.
         * Dispose the JFrame and after that destroy the cefApp
         */
        mainFrame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                CefApp.getInstance().dispose();
                System.exit(0);
            }
        });

        /*
         * Handler for allowing Javascript functions to invoke Java methods
         */
        CefMessageRouter msgRouter = CefMessageRouter.create();
        msgRouter.addHandler(new MessageRouterHandler(), true);
        client.addMessageRouter(msgRouter);

        /*
         * Handler for managing files downloads
         */
        DownloadDialog downloadDialog = new DownloadDialog(mainFrame);
        client.addDownloadHandler(downloadDialog);

    }

}


I´m just browsing google instead of the web app we actually need to use but the result is that I get the focus on google´s search input and for submitting I need to click on the search button. The enter key is not working and I can not go through the html controls hitting the tab key.
gteijido
Newbie
 
Posts: 5
Joined: Fri Nov 16, 2018 5:07 pm

Re: Special keys not working

Postby magreenblatt » Thu Nov 29, 2018 3:23 pm

Does the problem reproduce with the sample apps that JCEF provides?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Special keys not working

Postby gteijido » Thu Nov 29, 2018 3:30 pm

I´ll test those and get back to you with the result. Thank you very much for your support.
gteijido
Newbie
 
Posts: 5
Joined: Fri Nov 16, 2018 5:07 pm

Re: Special keys not working

Postby gteijido » Tue Dec 04, 2018 1:15 pm

magreenblatt I wanted to let you know I just tested the simple test client and the special keys work just fine and this also solves a problem I haven´t mentioned before that was that the mouse scroll wheel was scrolling very slowly and in the reverse direction. I´ll investigate a bit but it seems the main class should not extend Application but JFrame. I´m not very experienced with FX apps. I´ll try to learn what is the impact of this. Thank you very much for your support.
gteijido
Newbie
 
Posts: 5
Joined: Fri Nov 16, 2018 5:07 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 21 guests