Windows 8 软键盘未隐藏 [英] Windows 8 soft keyboard not hidden

查看:27
本文介绍了Windows 8 软键盘未隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个 Windows 应用商店应用,需要输入用户名和密码才能访问服务.当身份验证无法连接到服务时,我们会显示一个弹出窗口,要求重新输入他们的用户名和密码.

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?

推荐答案

我通过在显示弹出窗口之前将焦点设置在虚拟按钮上(宽度=0,高度=0)解决了这个问题.因此,当弹出窗口关闭时,焦点将放在不需要键盘的按钮上.如果没有这个,焦点就会放在最后一个聚焦的控件"上,它可能会在键盘上产生奇怪的行为.

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.

希望有所帮助.

狐狸

这篇关于Windows 8 软键盘未隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆