I have a Mainscreen with tabs. Each tab has its own overridden navigationClick method that looks like this
protected boolean navigationClick(int status, int time) {
fieldChangeNotify(1);
return true;
}
and other methods
public boolean isFocusable() {
return true;
}
protected void drawFocus(Graphics graphics,
boolean on) {
// Don't draw the default focus
}
protected void onFocus(int direction) {
super.onFocus(direction);
invalidate();
}
protected void onUnfocus() {
super.onUnfocus();
invalidate();
}
However, in my mainscreen, there is 3 of these tabs in a horizontalfieldmanager. An overridden fieldChanged is implemented like this
public void fieldChanged(Field field, int context) {
if (_tabArea != null) {
if (field == _tab1) {
delete(_tabArea);
_tabArea = displayTab1();
add(_tabArea);
} else if (field == _tab2) {
delete(_tabArea);
_tabArea = displayTab2();
add(_tabArea);
} else if (field == _tab3) {
delete(_tabArea);
_tabArea = displayTab3();
add(_tabArea);
}
}
}
which switches the tabs. I have a navigationClick below that handles the clicks on the listfield, however ever since I overrode the navigationClick, that tab switching no longer works. Anyone have any idea why?
protected boolean navigationClick(int status, int time) {
Field field = _listfield;
if(field instanceof ListField)
{
int selected = _listfield.getSelectedIndex();
switch (selected) {
case 0:
delete(_tabArea);
All all = new All();
_tabArea = all.getVFM();
add(_tabArea);
break;
case 1:
break;
}
return true;
}
return super.navigationClick(status, time);
}
Does your override call super.navigationClick() in all cases?
Based on your code for navigationClick, it looks like super.navigationClick() won't be called, because if(field instanceof ListField)
prevents execution from reaching the super call.