Aug 07 2013

Using Awesomium with MonoGame – Backspace

A problem with the code presented in my previous post is that it won’t work with the special case of the Backspace key, however it can still be handled with a few small additions, based on the code I found in this question on the Awesomium forums. I have changed my code to the following:

    WebKeyboardEvent webKeyboardEvent = new WebKeyboardEvent();
    if (character == '\b')
        webKeyboardEvent.Type = WebKeyboardEventType.KeyDown;
        webKeyboardEvent.VirtualKeyCode = VirtualKey.BACK;
        webKeyboardEvent.Type = WebKeyboardEventType.KeyUp;
        webKeyboardEvent.Type = WebKeyboardEventType.Char;
        webKeyboardEvent.Text = new String(new char[] { character, (char)0, (char)0, (char)0 });

Leave a Reply

Your email address will not be published. Required fields are marked *

× 5 = ten

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>