1

I'm trying to process characters in a text field for a custom 3D game engine wrapped in a UWP application.

To process these characters in English, we have been using CoreWindows's CharacterReceived events. This works without a problem on the Xbox One with the english locale. We send our captured characters to the engine and it renders appropriately.

However, we are running into an issue when we change the language of the virtual keyboard (example french Canada, spanish mexico). The event does not fire for most characters, example, @, <, and >, which prevents us from propagating the symbols to our engine. Alphanumeric characters still work.

I've created a sample application in C# to take our engine out of the equation entirely and I'm getting the exact same results. Here's the relevant sample code:

protected override void OnWindowCreated(WindowCreatedEventArgs args){
    base.OnWindowCreated(args);

    var window = args.Window;
    window.CoreWindow.CharacterReceived += CoreWindow_CharacterReceived;
}

private void CoreWindow_CharacterReceived(CoreWindow sender, CharacterReceivedEventArgs args)
{
    System.Diagnostics.Debug.WriteLine("Received Event KeyCode: {0}, KeyStatus: {1}", args.KeyCode, args.KeyStatus.ToString());
}

The sample app has a TextBox defined in Xaml to allow me to bring up the Keyboard as well. The text field processes the symbols well, but the event does not.

I could process keypresses, but I would rather not go that rabbit hole as it is different for each locale.

Any idea why this event is not processing symbols?

  • For _DirectX Tool Kit_ [Keyboard](https://github.com/Microsoft/DirectXTK/blob/master/Src/Keyboard.cpp), I use ``CoreDispatcher.AcceleratorKeyActivated``. Would that work for you? – Chuck Walbourn May 03 '18 at 05:41
  • I'm getting similar events to KeyDown event, and not characters - but that might be a nice place to isolate the hack I was thinking of doing in KeyDown from the rest of our KeyDown logic. – Daniel Lanthier May 03 '18 at 13:37
  • @DanielLanthier Have you solved your issue by using `KeyDown` event? – Xie Steven May 04 '18 at 02:56
  • @XavierXie-MSFT Yes - I have had to handle key presses for both of our supported languages. Not ideal. – Daniel Lanthier May 04 '18 at 12:29

0 Answers0