CEF stole my keyboard events!

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.

Re: CEF stole my keyboard events!

Postby DavidSheth » Fri Mar 18, 2016 2:18 pm

Okay here's what I did:

Using the above link you showed me above: https://github.com/cefsharp/CefSharp/bl ... Handler.cs

I added a new class to my project, named it IKeyboardHandler.vb

Got the C# code converted to vb too

Image

Then, the namespace CefSharp was conflicting with the original one so I changed that line from "Namespace CefSharp" to "Namespace CefSharp2".

Then in my form code, here's what I've added as you've mentioned earlier:

Image

That's what I mean by its not yet defined. What can I do now?
DavidSheth
Newbie
 
Posts: 9
Joined: Wed Mar 16, 2016 10:51 am

Re: CEF stole my keyboard events!

Postby amaitland » Fri Mar 18, 2016 4:00 pm

Do you come from a programming background? You seem to be missing a key concept here. I don't meany any offense, perhaps there's someone you work with that can explain?

browser.KeyboardHandler is of type `CefSharp.IKeyboardHandler`, you need to create a class that implements that existing interface.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1291
Joined: Wed Jan 14, 2015 2:35 am

Re: CEF stole my keyboard events!

Postby DavidSheth » Sat Mar 19, 2016 1:46 am

Um, no. I do programming as a hobby. : )

Okay so could you show me how I can do that?

This is what I think is how to do it:
Create a new class, add the code from https://github.com/cefsharp/CefSharp/bl ... Handler.cs
In Sub New, add - Browser.KeyboardHandler = New KeyboardHandler

Have I left out anything and is that where I'm going wrong? Thanks
DavidSheth
Newbie
 
Posts: 9
Joined: Wed Mar 16, 2016 10:51 am

Re: CEF stole my keyboard events!

Postby amaitland » Sat Mar 19, 2016 4:47 am

I don't know VB.Net (avoid it where possible), so I cannot help you sorry.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1291
Joined: Wed Jan 14, 2015 2:35 am

Re: CEF stole my keyboard events!

Postby DavidSheth » Wed Mar 23, 2016 1:23 am

Okay.. Thanks anyway
DavidSheth
Newbie
 
Posts: 9
Joined: Wed Mar 16, 2016 10:51 am

Re: CEF stole my keyboard events!

Postby DavidSheth » Wed Mar 23, 2016 11:04 pm

Hey! I'm sorry! I found out how to do it! The code auto-inputs once you press Enter after typing Implements!

Okay so I'll need to make the form detect keypresses. So there should be a way to forward these keys to the form...

So what do I put between these lines?

Public Function OnKeyEvent(browserControl As IWebBrowser, browser As IBrowser, type As KeyType, windowsKeyCode As Integer, nativeKeyCode As Integer, modifiers As CefEventFlags, isSystemKey As Boolean) As Boolean Implements CefSharp.IKeyboardHandler.OnKeyEvent

End Function

Thanks!
DavidSheth
Newbie
 
Posts: 9
Joined: Wed Mar 16, 2016 10:51 am

Previous

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 34 guests