黑莓事件处理和焦点问题 [英] Blackberry Event Handling and Focus Issues

查看:366
本文介绍了黑莓事件处理和焦点问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有哪里触摸事件正在由具有焦点1 2的某些字段处理一个小的BlackBerry应用程序的问题。

I am having an issue with a small blackberry application where touch events are being processed by 1 of 2 certain fields that has focus.

在我的情况,我有2张图像,一个在顶部(屏幕上的第一个元素),并在底部(添加到屏幕上最后一个元素。两者都是BitmapField的子类。他们的目的是显示一个网站当用户点击(点击与触控板/球)。

In my case, I have 2 images, one at the top (first element on the screen) and at the bottom (last element added to the screen. Both are subclasses of the BitmapField. Their purpose is to display a web site when the user taps (clicks with the trackpad/ball).

问题是,当其中任一具有焦点,无论用户点击屏幕上(即在EditField中,另一个自定义按钮,或者只是一个背景的一部分)上,具有焦点消耗事件调用的BitmapField的网络浏览器。这显然​​只对BB火炬模拟器的问题,我对建设BB OS 5.0。

The issue is when either of these has focus, no matter where the user taps on the screen (i.e. in an EditField, another custom button, or just a part of the background), the BitmapField that has focus consumes the event calls the web browser. This obviously only an issue on the BB Torch simulator, and I building for BB OS 5.0.

我有BitmapField既耗费导航点击和触摸事件。

I have the BitmapField consuming both navigation clicks and touch events.

此外,(由RIM写为不)从哪里获得良好的方向,为黑莓API事件处理指南将是有益的。

Also, any direction on where to get a good (as in not written by RIM) event handling guide for the Blackberry API would be helpful.

更新:
我曾尝试:

UPDATE: I have tried:

    public boolean isFocusable() {
        return false;
    }

不过,理想情况下,我想这在设备上,如曲线和大胆工作。

But, ideally I would like this to work on devices such as the Curve and Bold.

更新2:
有一对夫妇的布局管理器里面LabelFields可以获得焦点,但它们不会引起这个问题的,它只有当BitmapFields具有焦点发生。

UPDATE 2: There a couple of LabelFields inside layout managers that can receive focus, but they do not cause this issue, it only happens when the BitmapFields have focus.

推荐答案

我建议由字段继承创建自定义图像按钮场。覆盖漆(图形图像)来绘制图像和聚焦的边界(或背景)。然后,只需覆盖 navigationClick(INT的地位,诠释时间)。当用户点击触摸屏上的字段中的BB UI框架将调用该方法。以及它会工作的非触摸屏设备。作为一个很大的好处 - 你不需要理会自己与的TouchEvent (7)。

I'd suggest to create a custom image button field by subclassing from Field. Override paint(Graphics graphics) to draw image and focused border (or background). Then just override navigationClick(int status, int time). The BB UI framework will call that method when user clicks your field on a touch screen. As well it'll work for a non-touch screen devices. As a great benefit - you will not need to bother yourself with TouchEvents at all.

这篇关于黑莓事件处理和焦点问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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