|
Re: Intercept System Keys in Windows XP [message #306021 is a reply to message #305772] |
Tue, 18 July 2006 13:54 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Hi Jim, sorry for the late response,
You can add a filter to the display and set the event's doit to false
whenever F10 comes through. See the snippet below:
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
shell.setBounds(10,10,200,200);
Menu bar = new Menu(shell, SWT.BAR);
shell.setMenuBar(bar);
MenuItem file = new MenuItem(bar, SWT.DROP_DOWN);
file.setText("File");
Text text = new Text(shell, SWT.MULTI);
text.setBounds(10,10,100,100);
display.addFilter(SWT.KeyDown, new Listener() {
public void handleEvent(Event event) {
if (event.keyCode == SWT.F10) {
System.out.println("F10!");
event.doit = false; // <---
}
}
});
text.addListener(SWT.KeyDown, new Listener() {
public void handleEvent(Event event) {
System.out.println("key down");
}
});
shell.open();
while(!shell.isDisposed()) {
if(!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Grant
"Jim Graf" <jgraf@applied.com> wrote in message
news:20009784.1152714825653.JavaMail.root@cp1.javalobby.org...
> My RCP app contains a third-party greenscreen terminal emulator that uses
the function keys to navigate through its pages. One of those keys is F10,
which presents a problem because by default Windows XP uses F10 to send
focus to the File menu. The terminal emulator receives the keystroke event
and it processes the F10 key, but then the key is processed by Windows,
which sets focus to the File menu. This is very frustrating for our users
because none of the other function keys have this problem.
>
> Any ideas?
|
|
|
Powered by
FUDForum. Page generated in 0.03992 seconds