KeyEvent for Enter/Return not working on Mac

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

KeyEvent for Enter/Return not working on Mac

Postby stephen » Tue Apr 28, 2015 4:40 pm

Hi, I'm using JCEF and everything seems to work flawlessly except that I can't simulate the enter key. The following sort of thing works for all alphanumeric keys:

Code: Select all
   KeyEvent ev2 = new KeyEvent(canvas_, KeyEvent.KEY_TYPED, 0, 0, 0, '\r');
   sendKeyEvent(ev2);


I've also tried the other newline character:

Code: Select all
   KeyEvent ev2 = new KeyEvent(canvas_, KeyEvent.KEY_TYPED, 0, 0, 0, '\n');
   sendKeyEvent(ev2);


I've also tried with KEY_PRESSED instead of KEY_TYPED, which works for keys like tab and arrows:

Code: Select all
  KeyEvent ev2 = new KeyEvent(canvas_, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_ENTER, '\n');
  sendKeyEvent(ev2);


Nothing seems to work. BTW, I'm on a Mac. And the snippets above are inside a class that extends CefBrowser_N, so the sendKeyEvent function above belongs to CefBrowser_N.

Can anyone help me out? Could this be a bug with CEF or JCEF? I would really appreciate it. I'm SO CLOSE to having a beautiful embedded browser experience inside my 3d game.
stephen
Newbie
 
Posts: 2
Joined: Tue Apr 28, 2015 4:18 pm

Re: KeyEvent for Enter/Return not working on Mac

Postby stephen » Wed Apr 29, 2015 12:01 pm

Also, I just realized I should probably have posted this under "JCEF" instead of "Support". Is there a way to move it or should I just repost?
stephen
Newbie
 
Posts: 2
Joined: Tue Apr 28, 2015 4:18 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 139 guests