简体   繁体   English

两个领域同时聚焦

[英]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.

相关问题 数据库架构的最佳方法主要集中在按年和按月同时存储不同字段的数据 - Best approach for database architecture heavily focused on storing data of different fields by year and by months at the same time 为什么两个文本字段中的逗号同时放置而没有焦点? - Why is the comma in two text fields put at the same time without focusing? 如何检测是否同时触摸了两个精灵? - How to detect if two sprites are being touched at the same time? MongoDB,使用java同时更新三个文件字段,有时只更新两个字段 - MongoDB,using java to update three fields of document at the same time,sometimes only two fields is updated 同时进行字段验证 - making fields validation at the same time 同时执行两个actionCommand? - two actionCommand at the same time? 如何在不重复的情况下随机生成两个数字? - How should I randomly generate two numbers at the same time without them being duplicated? 模态的前两个字段未发送密钥 - Keys not being sent for first two fields in modal 需要代码来理解同步的 static 和同一实例上的两个不同线程同时访问的非静态方法 - Need code to understand synchronized static and non-static methods being accessed at the same time by two different threads on the same instance 同时关闭两个JDialogs - Closing two JDialogs at the same time
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM