Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » canceling key event
canceling key event [message #756829] Tue, 15 November 2011 09:59 Go to next message
Maxime Jeanmart is currently offline Maxime JeanmartFriend
Messages: 35
Registered: November 2010
Member
Hi all,

Does anyone know how to stop a key pressed from being added to the text of a text field?

I'm trying to implement some kind of content assist in an SWT dialog. I'm catching the key sequence as configured in eclipse preferences and trigger the content assist. I tried this using a KeyListener or a Listener.
It works but if the configured key trigger is something like CTRL-SPACE, then a space is also added to my text field, which is not what I want. So I'd like to know a way to stop the key pressed from being added to the text field.

Thanks for any help,

Maxime



Re: canceling key event [message #756844 is a reply to message #756829] Tue, 15 November 2011 10:35 Go to previous messageGo to next message
Maxime Jeanmart is currently offline Maxime JeanmartFriend
Messages: 35
Registered: November 2010
Member
It looks like catching the Verify event and setting event.doit to false does the job.
Re: canceling key event [message #756927 is a reply to message #756844] Tue, 15 November 2011 14:57 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
In case you're interested, there's a snippet that demonstrates an
implementation of content assist at
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet320.java
..

Grant


On 11/15/2011 5:35 AM, Maxime Jeanmart wrote:
> It looks like catching the Verify event and setting event.doit to false
> does the job.
Previous Topic:not able to get back and forward function in browser widget
Next Topic:Configure SWT-temp directory location
Goto Forum:
  


Current Time: Thu Apr 25 15:16:57 GMT 2024

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

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

Back to the top