Presumably you will have some sort of GUI facilities, with several control types available for you to use. Each control must expose if it is interested in keyboard. For example, a TextField control will report that it wants keyboard input, while a Button will not.
Also your GUI engine will have to track which control has focus, based on what the user taps.
Once you have implemented the above, you know that you need to pop the keyboard when the focus moves to a control that reports itself as wanting keyboard input. Inversely, you will hide the keyboard when the focus goes to a control that does not want keyboard input.
发布评论
评论(1)
想必您将拥有某种 GUI 工具,其中有多种控件类型可供您使用。如果每个控件对键盘感兴趣,则必须公开它。例如,TextField 控件将报告它需要键盘输入,而 Button 则不会。
此外,您的 GUI 引擎还必须根据用户点击的内容来跟踪哪个控件具有焦点。
一旦实现了上述内容,您就知道当焦点移动到报告自身需要键盘输入的控件时需要弹出键盘。相反,当焦点转到不需要键盘输入的控件时,您将隐藏键盘。
Presumably you will have some sort of GUI facilities, with several control types available for you to use. Each control must expose if it is interested in keyboard. For example, a TextField control will report that it wants keyboard input, while a Button will not.
Also your GUI engine will have to track which control has focus, based on what the user taps.
Once you have implemented the above, you know that you need to pop the keyboard when the focus moves to a control that reports itself as wanting keyboard input. Inversely, you will hide the keyboard when the focus goes to a control that does not want keyboard input.