Frage

I am currently making a web browser in MonoDevelop using C#, but I am having problems implementing the Keypress event.

I already know the code for how to make the web browser navigate, but the problem is that the keypress event for the enter key won't fire in the textbox.

I have tried other alphabetic keys (like Gdk.Key.a), and they work properly, but the enter key does not work.

I have also tried add [GLib.ConnectBefore] attribute before the keypress event, but it still doesn't make a difference.

Can someone please give me the whole code, if you don't mind? Because there are three different types of Enter keys in the Gdk.Key function, and I don't know which one to use.

I am using MonoDevelop 2.6

Thanks for your help

War es hilfreich?

Lösung

I have figured out how to solve this problem.

I was using the wrong event.

You do NOT use the OnKeyPress or OnKeyRelease events to get the signal of the Enter key. You would need to use the Control.Activated event.

The Activated event fires only when the return (enter) key is pressed.

I hope it's the same for every one!

Thanks for trying to help!

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top