locked
Focus textbox through FocusState::Programmatic cannot open Touch Keyboard after do a clicking on Surface tablet with mouse connected

    Question

  • I have problem about Touch Keyboard when develop Windows 8.1 Store app on Surface tablet.

    My sample app for reproducing this issue have some control elements:

    - one Textbox named "KeyboardOpener". This textbox will get focus by 

    KeyboardOpener->Focus(FocusState::Programmatic) calling to open Touch keyboard.

    - one Button named "FocusDummy". This button will get focus when I want to make the textbox lost focus by

    FocusDummy->Focus(FocusState::Programmatic)

    - one Button named "ShowHideTextbox". When click on this button, the Textbox will be GotFocus or LostFocus.

    My problem will happen when I connect a mouse to tablet. I click on anywhere on the screen, then I focus on Textbox by

    KeyboardOpener->Focus(FocusState::Programmatic), but in this case, the Touch keyboard could not be invoked.

    If I tab on the Textbox, the Touch Keyboard will be opened normally.

    May I have the help from anyone to solve this issue?

    Thanks

    Monday, July 14, 2014 3:28 PM

Answers

  • Why are you using a Xaml TextBox to try to hack the input pane? Apps specifically do not have direct control over the input pane. While you can try to fool the system this isn't contractual. In most cases there is a better way.

    If you aren't using a TextBox for your app UI then you should provide appropriate accessibility information from the control you are using so that the system can treat it as a text control directly.

    --Rob

    Wednesday, July 16, 2014 11:47 PM
    Moderator

All replies

  • What is the overall goal and design? Why are you trying to do this? Are you trying to allow input to a control which isn't properly reporting itself as a text control? If so, the right thing to do is to fix that control.

    Apps specifically do not have direct control over the input pane. While you can try to fool the system this isn't contractual. In most cases there is a better way.

    --Rob

    Monday, July 14, 2014 3:47 PM
    Moderator
  • Actually, I don't use textbox of Xaml for my app UI, I just use it to focus and open Touch Keyboard and get input text to pass to the UI, so I must use Focus(FocusState::Programmatic) calling instead of focusing textbox by a touch action. The textbox will be hidden, just content of it from Touch Keyboard input is used.

    If I don't perform a mouse click on screen, the Focus(FocusState::Programmatic) works normally and the Touch Keyboard is opened. Otherwise, this kind of focusing doesn't work on textbox and Touch Keyboard is not opened while the textbox got focus.

    I don't know why the mouse action effects to the focusing of textbox by API calling.



    Tuesday, July 15, 2014 4:57 AM
  • Why are you using a Xaml TextBox to try to hack the input pane? Apps specifically do not have direct control over the input pane. While you can try to fool the system this isn't contractual. In most cases there is a better way.

    If you aren't using a TextBox for your app UI then you should provide appropriate accessibility information from the control you are using so that the system can treat it as a text control directly.

    --Rob

    Wednesday, July 16, 2014 11:47 PM
    Moderator