Hi there,
for my app I need the space key to call a function independent from the focused widget, everywhere in the app but only if the according tab is opend. I found that one can add a filter to the display, like this:
getShell().getDisplay().addFilter(SWT.KeyDown, new Listener() {
public void handleEvent(Event arg0) {
if( arg0.character == 32 ) { /**SPACE*/
if( mainTabs.getSelection().equals(analyseSoundFilesTab)) {
soundController.playButtonClickHandler();
}
}
}
});
That works fine most of the time, but if I give a button the focus via the "tab" or "shift tab", its kinda strange - the space bar will than activate a "button pressed", as if one clicks the button with the mouse. Im a bit stuck now, I don't know how to avoid this... For the buttons, I have implemented a SelectionListener.
Regards.