Dan
Dan

Reputation: 343

UWP touch keyboard won't remain visible

I'm trying to get the InputPane touch keyboard to display correctly in a Universal Windows app using the ANGLE API. (I have some custom input controls written in using OpenGL in an Android native app, and I'm porting them over to a UWP app.)

Everything works as expected, except for the touch keyboard (all pointer input is received correctly, and keyboard interactions are fine if I attach a hardware keyboard). I can get the InputPane to display, but then it immediately disappears from the screen.

Here's all my code related to InputPane:

void App::SetWindow(CoreWindow^ window)
{
    ...

    InputPane ^input_pane = InputPane::GetForCurrentView();
    input_pane->Showing += ref new TypedEventHandler<InputPane^, InputPaneVisibilityEventArgs^>(this, &App::OnInputPaneShowing);
    input_pane->Hiding += ref new TypedEventHandler<InputPane^, InputPaneVisibilityEventArgs^>(this, &App::OnInputPaneHiding);

    auto core_text_manager = CoreTextServicesManager::GetForCurrentView();
    auto core_text = core_text_manager->CreateEditContext();
    core_text->InputPaneDisplayPolicy = CoreTextInputPaneDisplayPolicy::Manual;
}

void App::OnInputPaneShowing(InputPane^ sender, InputPaneVisibilityEventArgs^ args)
{
    args->EnsuredFocusedElementInView = true;
}

void App::OnInputPaneHiding(InputPane^ sender, InputPaneVisibilityEventArgs^ args)
{
    args->EnsuredFocusedElementInView = true;
}

Several SO questions such as this one simply recommend calling InputPane::TryShow(), but I'm already doing that. The InputPane is appearing, it just disappears right away (it doesn't generate a Hiding event when it does so).

Per suggestions in other SO questions, I tried setting EnsuredFocusedElementInView to true, though that was more of a shot in the dark, since I don't actually have any Control objects in my app. Setting the display policy to Manual (as shown) instead of Automatic produced identical results.

This behavior occurs whether the app is fullscreen or windowed, in both desktop and tablet mode. There is no hardware keyboard attached. Invoking the keyboard from the taskbar icon and then interacting with the app results in the keyboard immediately disappearing as before.

If anyone has any thoughts, they would be greatly appreciated. Thank you.

Upvotes: 0

Views: 175

Answers (0)

Related Questions