Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Intercept System Keys in Windows XP
Intercept System Keys in Windows XP [message #305772] Wed, 12 July 2006 14:33 Go to next message
Jim Graf is currently offline Jim GrafFriend
Messages: 12
Registered: July 2009
Junior Member
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?
Re: Intercept System Keys in Windows XP [message #306021 is a reply to message #305772] Tue, 18 July 2006 13:54 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
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?
Previous Topic:How to disable the "Build Automaticall" feature
Next Topic:Eclipse 3.2 on Windows XP x64
Goto Forum:
  


Current Time: Tue Apr 23 13:25:57 GMT 2024

Powered by FUDForum. Page generated in 0.03992 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top