Problem:
I have a TabPanel with few tabs, and one of them has a "properties" editor. Some properties are edited using a TextField cotrol, and when I want to go to the beginning or end of the field I press, naturally, the keys HOME or END, and then the TabPanel container changes the selected tab to first one or last one... so I lose my focus on field editing ... very very ugly indeed ! Workaround is "don't use HOME and END keys", but I can't help it -- I press them all the time :)
Is there a solution for this problem?
The answer for this question is very simple, YES, like the solution itself.
Solution:
We have to override the "pressed key handler" (good thing that it's protected, and not private), which is providing this ugly behavior, like in this sample code:
public class MyTabPanel extends TabPanel {
/**
* Override this function to get rid of the HOME, END keys problem.
*/
@Override
protected void onKeyPress (ComponentEvent ce) {
/* do nothing */
}
}
and then use the MyTabPanel instead of the default one. I know, this is an ugly simple solution, but efficient!
Cheers!
Subscribe to:
Post Comments (Atom)
Participant
No comments:
Post a Comment