Hello,
I have been trying to add keyboard shortcuts to tabsheets. It works only for first tabsheet and not subsequent ones.
My code below has 2 tabsheets and second tabsheet has 3 more tabs in it.
I can only go from first tabsheet to second using TAB but nothing else works.
A quick help by anybody is highly appreciated!
mainTab = new TabSheet(); //main
searchTab = new TabSheet();
tabsResults = new TabSheet();
//tabResults which is the second tabsheet has 3 tabs within it
tabsResults.setWidth(RESULTS_TAB_SIZE);
querySummary = // returns a Panel
metrics = // returns a Panel
decisions = // returns a Panel
querySummary.addShortcutListener(new ShortcutListener("Tab", ShortcutAction.KeyCode.TAB, null) {
@Override
public void handleAction(Object sender, Object target) {
tabsResults.setSelectedTab(1);
}
});
metrics.addShortcutListener(new ShortcutListener("Tab", ShortcutAction.KeyCode.TAB, null) {
@Override
public void handleAction(Object sender, Object target) {
tabsResults.setSelectedTab(2);
}
});
decisions.addShortcutListener(new ShortcutListener("Tab", ShortcutAction.KeyCode.TAB, null) {
@Override
public void handleAction(Object sender, Object target) {
tabsResults.setSelectedTab(0);
}
});
tabsResults.addTab(querySummary, "sub tab1");
tabsResults.addTab(metrics, "sub tab2");
tabsResults.addTab(decisions, "sub tab3");
searchTab.setWidth(RESULTS_TAB_SIZE);
searchTab.addShortcutListener(new ShortcutListener("Tab 1", ShortcutAction.KeyCode.TAB, null) {
@Override
public void handleAction(Object sender, Object target) {
mainTab.setSelectedTab(1);
}
});
tabsResults.addShortcutListener(new ShortcutListener("Tab 2", ShortcutAction.KeyCode.TAB, null) {
@Override
public void handleAction(Object sender, Object target) {
mainTab.setSelectedTab(2);
}
});
searchTab.addComponent(createComplexSearchComponent());
mainTab.addTab(searchTab, "Search");
mainTab.addTab(tabsResults, "Results");