Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Cell editor activation with keypress
Cell editor activation with keypress [message #703352] Wed, 27 July 2011 13:31 Go to next message
Marco Maccaferri is currently offline Marco MaccaferriFriend
Messages: 132
Registered: July 2009
Senior Member
Hi,

I'm not sure if this belongs to JFace or SWT. I have a table with cell
editors, I would like to activate a cell editor with a keypress (any
key) and pass that key to the editor immediately (the key used to
activate the editor is also the first key typed in the editor).

So far I was able to activate the editor but the key is swallowed every
time. Is there a way to do what I want ?

Regards,
Marco.
Re: Cell editor activation with keypress [message #703367 is a reply to message #703352] Wed, 27 July 2011 13:42 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5467
Registered: July 2009
Senior Member
Hi,

You'll have to subclass e.g. TextCellEditor and overwrite
activate(ColumnViewerEditorActivationEvent) which provides you the event
which activated the editor and in case of a key event copy the character
to the text control.

Tom

Am 27.07.11 15:31, schrieb Marco Maccaferri:
> Hi,
>
> I'm not sure if this belongs to JFace or SWT. I have a table with cell
> editors, I would like to activate a cell editor with a keypress (any
> key) and pass that key to the editor immediately (the key used to
> activate the editor is also the first key typed in the editor).
>
> So far I was able to activate the editor but the key is swallowed every
> time. Is there a way to do what I want ?
>
> Regards,
> Marco.
Re: Cell editor activation with keypress [message #704422 is a reply to message #703367] Thu, 28 July 2011 15:38 Go to previous message
Marco Maccaferri is currently offline Marco MaccaferriFriend
Messages: 132
Registered: July 2009
Senior Member
On 27/07/2011 15:42 Tom Schindl ha scritto:

> You'll have to subclass e.g. TextCellEditor and overwrite
> activate(ColumnViewerEditorActivationEvent) which provides you the event
> which activated the editor and in case of a key event copy the character
> to the text control.

Thanks for the tip, it works well.

I'm using ((Text) getControl()).insert() in an asyncExec runnable to set
the typed character to the text control (otherwise the cursor won't be
positioned correctly). It works, but do you think there is a better way
to do that ?

Regards,
Marco.
Previous Topic:How to clear Viewer?
Next Topic:Is a fixed height view possible?
Goto Forum:
  


Current Time: Wed Nov 26 08:18:34 GMT 2014

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

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