2

We have a Windows Store app that requires the entry of a username and password for accessing a service. When authentication fails connecting to the service we display a popup asking to re-enter their username and password.

On a tablet when the user puts the focus on the username or password fields the soft keyboard is displayed correctly. Our login screen is adjusted on detection of the soft keyboard so that all fields and buttons are visible.

This all works no problem and when they enter their details and tap on the login button the popup is closed and the app continues.

However for some reason I cannot work out if the user has the focus on the Username textbox and then taps on the login button the soft keyboard is not hidden. The popup is dismissed and the app continues but it leaves the soft keyboard displayed. If the focus was in the password box then the keyboard is hidden as expected.

I have tried setting the focus to the button controls in the button click events but this does not solve the issue. Possibly because the button clicks also close the popup control.

Has anyone come across this before? Apart from setting the focus to another control (which isn't working in my situation) is there any other way to close the soft keyboard?

Gavin Bateup
  • 93
  • 1
  • 8

2 Answers2

2

I solved the problem by setting the focus on a fictive button (width=0, height=0) before displaying a popup. So when the popup is closed, the focus is placed on the button which it does not need the keyboard. Without this, the focus is given on the last focused "control" that can have a strange behaviour with the keyboard.

Hoping to have helped.

Fox

fox_magic
  • 21
  • 2
0

You cannot control when the touch keyboard is shown or hidden. This white paper describes in detail the logic behind when the keyboard is shown and/or hidden. From the last paragraph:

This means that applications cannot programmatically invoke the touch keyboard via manipulation of focus.

JP Alioto
  • 44,864
  • 6
  • 88
  • 112