Blackberry OS6: implementing click event on extended MapLocation class

147 views Asked by At

I need to change what happens when a user clicks on a pin in a RichMapField, and these pins happen to be MapLocation objects, these MapLocations also optionally handle a different datatype known as a "Partner" class which contains an ID, Address, Label, Latitude and Longitude.

Everything runs great, and as it stands at the moment when you hover over the pin it still gives the label and such, but when you click on the pin, does nothing.

This behaviour is expected! So to this point, everything went great.

What I cant seem to figure out, is how to attach a click or touch listener to the new custom MapLocation object.

heres the code without much further adu:

import net.rim.device.api.lbs.maps.model.MapLocation;
import net.rim.device.api.ui.component.Dialog;

public class CustomMapLocation extends MapLocation {

    private Partner partner;

    public KRMapLocation(double lat, double lon, String label, String address) {
         setLat(lat);
         setLon(lon);
         setName(label);
         setDescription(address);
    }

    public KRMapLocation(Partner p) {
        this.partner = p;
        setLat(partner.getLatitude());
        setLon(partner.getLongitude());
        setName(partner.getName());
        setDescription(partner.getAddress());
    }

    // this does nothing...
    protected boolean trackwheelClick(int status, int time) {
        Dialog.alert("Trackwheel click");
        return true;
    }

}

This is literally the last thing I got to figure out, is Touch and Trackwheel listeners. Help on either or or both would be amazing... I have run google dry, and by now Google things I'm some sort of blackberry fanboy lol

Wits end guys, I hope someone can help me out!

(I know this is possible, as it used to have a click event that opened up a detail page, I just do not know what to do or even what I'm supposed to be looking for.)

1

There are 1 answers

2
Alex Kennberg On BEST ANSWER

My guess is that it's not the MapLocation that handles clicks. It's handled by the field, which uses MapLocation data just to get the coordinates, label, etc. I also had no luck yet in finding the right hook. It would be nice to at least be able to extend the default Details dialog that comes up.