I have a project (Void) using the Eto GUI framework for .NET and Mono. I am building a Vim-like text editor which will have at least some of the modes which Vim has (and yes, I know, one does not simply...).
The basic structure of my GUI is just a Form
whose Content
is a Drawable
, so that I have maximum flexibility over something which does not adhere to the normal styles of GUI apps. I have successfully attached a KeyUp
handler to the form when I stubbed out Normal mode and I have the ZQ
command closing the window.
KeyUp += (sender, eventArgs) =>
{
var keyPress = eventArgs.AsVoidKeyPress();
if (keyPress != null)
{
handler(keyPress);
}
};
That's fine and dandy for Normal mode, but for other modes such as Command Mode and Insert Mode, I want to be able to catch special key combinations (i.e. ones that use CTRL) but other than that I just want to capture stuff as text. This will allow me to handle Unicode, etc. In other words, I don't simply want to translate keystrokes back into text myself.
I tried to attach a TextInput
event.
Console.WriteLine("I see this, but...");
TextInput += (sender, eventArgs) =>
{
Console.WriteLine("...I don't see this, no matter what I type.");
};
I even commented out my subscription to the KeyUp
event to see if that is conflicting, but I just don't get any response. Is this because I am attaching it directly to the form? Is there any way to capture text input without actually using a text box?