[英]Two fields being focused at the same time
I'm developing a blackberry application and I'm having some problems setting the initial field focused (which isn't the fist field in the manager). 我正在开发一个黑莓应用程序,我在设置初始字段时遇到了一些问题(这不是管理器中的第一个字段)。 This is a piece of code of the screen's constructor:
这是屏幕构造函数的一段代码:
public class BaseScreen extends MainScreen {
...
public BaseScreen() {
...
//adding fields to attribute _body(Manager) including the field to be focused
...
add(_body)
_body.setFieldWithFocus(fieldToFocus);
}
...
}
As it turns out, the field fieldToFocus
does paint itself as focused once the screen is shown. 事实证明,一旦显示屏幕,字段
fieldToFocus
就会将自己绘制为焦点。 But so does the first field of the _body
manager. 但
_body
经理的第一个领域也是_body
。 This means I have two fields focused at the same time! 这意味着我有两个同时聚焦的领域!
What am I missing? 我错过了什么? Thanks
谢谢
Can you please try replacing this: 你可以试试替换这个:
_body.setFieldWithFocus(fieldToFocus); _body.setFieldWithFocus(fieldToFocus);
with this: 有了这个:
fieldToFocus.setFocus(); fieldToFocus.setFocus();
I am interested to know if this resolves your problem. 我很想知道这是否可以解决您的问题。
The method you have tried to use (setFieldWithFocus()) is not one that I have used in the past, and the fact that you see two focused Fields is an interesting effect. 您尝试使用的方法(setFieldWithFocus())不是我过去使用过的方法,而且您看到两个聚焦字段的事实是一个有趣的效果。 Can you tell use what OS and device (Simulator) you are seeing this on.
你能告诉你使用什么操作系统和设备(模拟器)吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.