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 ?
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.
> 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 ?