I'm having trouble with CustomItem and CommandItemListener. The 8130 emulator and 8830 handset do not present a "Select" Menu pick when pressing the pointer with the examples below. This only appears to be a problem when extending CustomItem. Attaching a CommandItemListener to a StringItem works as advertised so I must be missing something in the CustomItem though no other interfaces are required by the spec. Also, the supplied code works as advertised with the Sun WSTK and Samsung phones.
Code:
class FooItem extends CustomItem {
public final static String FOO = "click me";
public FooItem() {
super(null);
}
protected int getMinContentWidth() {
return Font.getDefaultFont().stringWidth(FOO);
}
protected int getMinContentHeight() {
return Font.getDefaultFont().getHeight();
}
protected int getPrefContentWidth(int arg0) {
return getMinContentWidth();
}
protected int getPrefContentHeight(int arg0) {
return getMinContentHeight();
}
protected void paint(Graphics g, int arg1, int arg2) {
g.drawString(FOO, 0, 0, g.TOP | g.LEFT);
}
}
The above field is then initialized in the following manner:
Code:
FooItem f = new FooItem();
f.setDefaultCommand(new Command("select me", Command.ITEM, 0);
f.setItemCommandListener(this);
form.append(f);
I'm stumped. I've added my own event handling to get around the problem (dispatch the listener within the custom item), however, that solution does not present the BB native L&F. Thanks for taking a look.
-t