Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] How to add key event filter for an applica tion?

Chris,

Thanks so much for your prompt help! It really helps me much. I didn't found it earlier because this method didn't become a public one until SWT 3.0. Just to be curious, how does eclipse plugins handle key bindings before release 3.0?

BTW, I have tried some code to test this method and found it works for both key events and mouse events. 

Thanks again.

-----Original Message-----
From: Chris McLaren [mailto:Chris_McLaren@xxxxxxxxxx] 
Sent: Thursday, November 13, 2003 12:40 PM
To: platform-swt-dev@xxxxxxxxxxx
Subject: Re: [platform-swt-dev] How to add key event filter for an application?


Display.addFilter(..) can be used to listen for key events (like 
SWT.KeyDown) before the event reaches the widget hierarchy. I don't think 
the same functionality exists for mouse events. 

Note: if you are developing plugins for eclipse, you should know that 
eclipse itself uses this method to process its own key bindings. Using 
this method in this case would be strongly discouraged.

Chris.





Xiong Huan-a16898 <huan.xiong@xxxxxxxxxxxx> 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
11/12/2003 11:00 PM
Please respond to
platform-swt-dev


To

platform-swt-dev@xxxxxxxxxxx
cc





Subject
[platform-swt-dev] How to add key event filter for an application?






Hi,
 
Can I intercept key or mouse events before they are sent to widgets? I 
have checked API document and found Display class has addListener(int 
eventType, Listener listener) method. However, when I tried the following 
code snippet, it never got called at all when I pressed key. 
 
     display.addListener(SWT.KeyDown, new Listener() {
          public ovid handleEvent(Event e) {
               System.out.println("Hello, world!");
          }
     });
 
Can anybody throw some light on this problem? Thanks.
 
 


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top