Image Map-like Blackberry Control - CLDC Application
Asked Answered
J

1

2

Does anyone know of an Image Map-like Blackberry Control that I can use in my CLDC application? If there isn't one, is there a way to get click x,y coordinates on a MainScreen or BitmapField derived control?

Thanks,

Jung answered 23/4, 2009 at 17:4 Comment(0)
B
4

I assume you're thinking of this control for the Storm - the only device for which clicking on an arbitrary point on screen makes sense.

In that case, the easiest way is probably to subclass BitmapField to be focusable and respond to clicks - something like this:

public class ClickableBitmapField extends BitmapField {
// Make the control focusable    
public boolean isFocusable() {
       return true; 
}

protected boolean touchEvent(TouchEvent message) {
    if (message.getEventCode == TouchEvent.CLICK) {
        int x = message.getX();
        int y = message.getY();
        // do something with x and y here
    }
}
}

Of course it'd be a lot more complicated to implement image map type functionality for a trackball device - you'd have to maintain a cursor or something so the user knows where they're clicking.

Brasilein answered 24/4, 2009 at 3:5 Comment(2)
I wanted something for all recent blackberry's. I ended up deriving from FullScreen and handling everything myself. It seems to work pretty well.Jung
Probably wise, given the (lack of?) impact the Storm's had in the marketplace - thanks for accepting the answer anyway!Brasilein

© 2022 - 2024 — McMap. All rights reserved.