Using CefKeyboardHandler

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Using CefKeyboardHandler

Postby sproc » Wed Jun 25, 2014 2:37 pm

Hello,

I have a win32 App which is using CEF for rendering Web Content. My App handles some of the Shortcut Keys (Ctrl+N, Ctrl+O, ...). But this stops happening when the CEF browser is Active or has Focus. The CEF Browser by default consumes all the Keyboard events. How to use "CefKeyboardHandler" correctly to prevent CEF Browser from handling this and pass onto my App.
sproc
Techie
 
Posts: 10
Joined: Wed Jun 04, 2014 12:53 pm

Re: Using CefKeyboardHandler

Postby magreenblatt » Wed Jun 25, 2014 2:49 pm

If you're using 1750 branch or newer this was fixed in https://code.google.com/p/chromiumembed ... il?id=1299. You can get newer builds from http://cefbuilds.com.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Using CefKeyboardHandler

Postby Sandy » Mon Nov 24, 2014 8:10 pm

sproc wrote:Hello,

I have a win32 App which is using CEF for rendering Web Content. My App handles some of the Shortcut Keys (Ctrl+N, Ctrl+O, ...). But this stops happening when the CEF browser is Active or has Focus. The CEF Browser by default consumes all the Keyboard events. How to use "CefKeyboardHandler" correctly to prevent CEF Browser from handling this and pass onto my App.


I have a win32 App which is the same with sproc's, and i want to handle some custom shortcut keys. Actually, I am using the version: cef_binary_3.2217.1905_windows32.7z. the custom accelerators as shown below, but I find that can't work. Is there something wrong?
thanks for the advice.
Code: Select all
IDC_CEFCLIENT ACCELERATORS
BEGIN
    "/",            IDM_ABOUT,              ASCII,  ALT, NOINVERT
    "?",            IDM_ABOUT,              ASCII,  ALT, NOINVERT
    VK_F8,          IDM_ABOUT,                VIRTKEY, NOINVERT
END
Sandy
Newbie
 
Posts: 2
Joined: Fri Nov 21, 2014 12:59 am

Re: Using CefKeyboardHandler

Postby magreenblatt » Tue Nov 25, 2014 11:27 am

Sandy wrote:the custom accelerators as shown below, but I find that can't work. Is there something wrong?

Do they work in cefclient if the URL text field has focus instead of the browser view?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Using CefKeyboardHandler

Postby Sandy » Tue Nov 25, 2014 10:04 pm

magreenblatt wrote:
Sandy wrote:the custom accelerators as shown below, but I find that can't work. Is there something wrong?

Do they work in cefclient if the URL text field has focus instead of the browser view?


Hi magreenblatt, Thanks for your reply. But the answer is: No, they don't work whether the URL text field has focus or not. while the URL text field has focus,the keyboard events don't enter the function"bool ClientHandler::OnPreKeyEvent(...)".
Sandy
Newbie
 
Posts: 2
Joined: Fri Nov 21, 2014 12:59 am

Re: Using CefKeyboardHandler

Postby magreenblatt » Wed Nov 26, 2014 12:09 am

The URL text field is a separate native control so it won't trigger key event callbacks. Accelerators specified in the resource file will not work in combination with CefRunMessageLoop. You likely need to implement your own accelerator logic in OnPreKeyEvent.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Using CefKeyboardHandler

Postby imlanjinhua » Wed Nov 26, 2014 8:45 am

try cefsettings.multi_threaded_message_loop = true,maybe it works.
imlanjinhua
Newbie
 
Posts: 3
Joined: Tue Nov 25, 2014 2:34 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 58 guests