Opening devtools for pop windows

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.

Opening devtools for pop windows

Postby tashimaya » Mon Oct 27, 2014 10:28 am

Hi

I have worked out how to open devtools from the main window like this:

Code: Select all
class KeyboardHandler : public CefKeyboardHandler
{
   bool OnKeyEvent(...)
   {
      // Catch Ctrl+Shift+i, do ShowDevTools() then return true;
      
      return false;
   }
}

But I am not sure how to do the same for pop windows because OnKeyEvent does not get called for them. Could anybody show me how to do that?

Many thanks
tashimaya
Techie
 
Posts: 36
Joined: Fri Oct 10, 2014 7:18 am

Re: Opening devtools for pop windows

Postby magreenblatt » Mon Oct 27, 2014 10:35 am

OnKeyEvent should be called for popup windows. What OS and CEF version are you using? Are you providing a different CefClient for the popup window via OnBeforePopup?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Opening devtools for pop windows

Postby tashimaya » Mon Oct 27, 2014 10:44 am

Many thanks for your quick reply.

> Are you providing a different CefClient for the popup window via OnBeforePopup?

Yes that's the case. In my OnBeforePopup() I'm creating a dummy CefClient object:

Code: Select all
bool OnBeforePopup(...)
{
   client = new DummyWebClient(); // If I comment out my OnKeyEvent() gets called
   return false;
}
 
private sealed class DummyWebClient : CefClient
{
}


So if I change the client for the new pop window, is there any way to make the window to listen for the OnKeyEvent?
tashimaya
Techie
 
Posts: 36
Joined: Fri Oct 10, 2014 7:18 am

Re: Opening devtools for pop windows

Postby magreenblatt » Mon Oct 27, 2014 11:23 am

tashimaya wrote:So if I change the client for the new pop window, is there any way to make the window to listen for the OnKeyEvent?

You need to implement CefKeyboardHandler in the CefClient for the popup window.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 81 guests