Hi *,
I think that I have found the problem in DateField. It does require the navigation logic there as well. I will post a Bug report on NachoCalendar (the issue is even on the WebStart demo).
In the meantime here is 'my' fix... In the WindowPanel of the DateField.java
Code:
KeyListener klistener = new KeyAdapter() {
public void keyTyped(KeyEvent e) {
if (e.getKeyChar() == 10) {
aceptar();
} else if (e.getKeyChar() == 27) {
cancelar();
}
}
// NEW METHOD -> Fix navigation issue.
public void keyPressed(final KeyEvent e) {
final int keycode = e.getKeyCode();
int move = 0;
int type = Calendar.DAY_OF_YEAR;
if ((keycode == KeyEvent.VK_LEFT) || (keycode == 226)) {
move = -1;
} else if ((keycode == KeyEvent.VK_RIGHT)) {
move = +1;
} else if ((keycode == KeyEvent.VK_UP)) {
move = -7;
} else if ((keycode == KeyEvent.VK_DOWN)) {
move = +7;
} else if ((keycode == KeyEvent.VK_PAGE_DOWN)) {
move = +1;
type = Calendar.MONTH;
} else if ((keycode == KeyEvent.VK_PAGE_UP)) {
move = -1;
type = Calendar.MONTH;
}
if (move != 0) {
final Calendar navigation = Calendar.getInstance();
navigation.setTime(datepanel.getDate());
navigation.add(type, move);
datepanel.setDate(navigation.getTime());
}
}
};
datepanel.addKeyListener(klistener);
I hope this helps...
Has anyone any suggestion in order to select the textfield content when it gets the focus? At the moment, it does not select anything which is poor ergonomics.
Cheers
Benoit