Skip to main content



      Home
Home » Eclipse Projects » JFace » Table Viewer - Selecting F2 on the key board does not put the cell into edit mode(Need to implement Table Cell Navigation and editing capability of data)
Table Viewer - Selecting F2 on the key board does not put the cell into edit mode [message #668297] Wed, 04 May 2011 18:47 Go to next message
Eclipse UserFriend
I have defined a table viewer with 80 table viewer columns.

I have defined the cell editing support along with standard cell navigation strategy.

I have defined the ColumnViewerEditorActivationStrategy as follows which specifies to activate column viewer editing when F2 key is pressed as follows :

ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(
v) {
protected boolean isEditorActivationEvent(
ColumnViewerEditorActivationEvent event) {
return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
|| event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.F2)
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && Character
.isSpaceChar(event.character))
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode > 31 && event.keyCode < 127)
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == 16777296)
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.F2)
|| event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
}
};

TableViewerEditor.create(v, focusCellManager, actSupport,
ColumnViewerEditor.TABBING_HORIZONTAL
| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
| ColumnViewerEditor.TABBING_VERTICAL
| ColumnViewerEditor.KEYBOARD_ACTIVATION);

I have seen lot of examples online which suggest this way of doing things but I am not sure if I am doing something wrong. Please help. Thanks!
Re: Table Viewer - Selecting F2 on the key board does not put the cell into edit mode [message #668298 is a reply to message #668297] Wed, 04 May 2011 18:53 Go to previous messageGo to next message
Eclipse UserFriend
By the way, I forgot to mention that when I hit any key on the key board or ENTER key or Space bar on the key board - the table cell that is currently in focus changes to edit mode.

Its only when I hit F2 key that the table cell does not change to edit mode, which is what I am looking for.

Any ideas on what I am doing wrong (if any) ? Code snippets that can help me fix this problem.
Re: Table Viewer - Selecting F2 on the key board does not put the cell into edit mode [message #668537 is a reply to message #668298] Fri, 06 May 2011 03:04 Go to previous messageGo to next message
Eclipse UserFriend
Is it possible that F2 is eaten by the OS? Can you try to attach a key
listener to the table and see if it gets the F2 event?

Tom

Am 05.05.11 00:53, schrieb Pavan K Immaneni:
> By the way, I forgot to mention that when I hit any key on the key board
> or ENTER key or Space bar on the key board - the table cell that is
> currently in focus changes to edit mode.
>
> Its only when I hit F2 key that the table cell does not change to edit
> mode, which is what I am looking for.
>
> Any ideas on what I am doing wrong (if any) ? Code snippets that can
> help me fix this problem.
>
Re: Table Viewer - Selecting F2 on the key board does not put the cell into edit mode [message #668539 is a reply to message #668297] Fri, 06 May 2011 03:34 Go to previous messageGo to next message
Eclipse UserFriend
Tom, Thanks for the response.

Yes you are right. When I added the key listener to the table and then hit F2 key on the key board, the key listener is not getting triggered. But when I hit any other key like PageUp, PageDown, F4, A, B, C, etc., the key listener is getting triggered.

I am using a Win 7 machine. Have you heard this problem before and if so what is your recommendation ?

Re: Table Viewer - Selecting F2 on the key board does not put the cell into edit mode [message #668549 is a reply to message #668539] Fri, 06 May 2011 04:06 Go to previous messageGo to next message
Eclipse UserFriend
Can you try this on a pure SWT-Table as well?

Tom

Am 06.05.11 09:34, schrieb Pavan K Immaneni:
> Tom, Thanks for the response.
>
> Yes you are right. When I added the key listener to the table and then
> hit F2 key on the key board, the key listener is not getting triggered.
> But when I hit any other key like PageUp, PageDown, F4, A, B, C, etc.,
> the key listener is getting triggered.
> I am using a Win 7 machine. Have you heard this problem before and if so
> what is your recommendation ?
>
Re: Table Viewer - Selecting F2 on the key board does not put the cell into edit mode [message #670422 is a reply to message #668549] Fri, 13 May 2011 21:15 Go to previous messageGo to next message
Eclipse UserFriend
Tom,

I tried with SWT Table and its the same problem.

Also the other problem is when ever I enter any character on the key board the table cell is put into edit mode but I am getting a beep. Any way I can avoid the beep ?

I changed the code as follows to enable cell editing when any character is entered on the key board.

ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(v) {
protected boolean isEditorActivationEvent(
ColumnViewerEditorActivationEvent event) {
return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
|| event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTI ON
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.F2)
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
|| (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode > 31 && event.keyCode < 127)
|| event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
}
};

Any thoughts ?

Thanks,
Pavan
Re: Table Viewer - Selecting F2 on the key board does not put the cell into edit mode [message #729574 is a reply to message #670422] Mon, 26 September 2011 10:36 Go to previous messageGo to next message
Eclipse UserFriend
Sorry to bump this, but I'm having the same issue: the F2 key doesn't seem to be recognized as a key event when pressing it. Adding a KeyListener won't even trigger the keyPressed/keyReleased events at all. Similarly, the ColumnViewerEditorActivationStrategy.isEditorActivationEvent() method won't be called either, if one is set.

Seems like any other key works, but not F2 (tried on three different browsers, Chrome/Firefox/IE9, just in case).

Is this a RAP bug? Or are we missing something?

Thanks,

Jérémy

edit: thought this was posted in the RAP forum. Apparently, this is not related to it specifically. Still, this is pretty annoying!

[Updated on: Mon, 26 September 2011 10:49] by Moderator

Re: Table Viewer - Selecting F2 on the key board does not put the cell into edit mode [message #730010 is a reply to message #729574] Tue, 27 September 2011 09:23 Go to previous messageGo to next message
Eclipse UserFriend
OK, allow me to respond to myself. It seems like the reason why F2 is not captured is because it's defined as an internal keyBinding for the org.eclipse.ui.edit.rename action, at least in RAP applications (and probably RCP). That means if you want a rename command, you should probably use this commandId instead of defining your own one, then F2 will call its handler.

In the OP's case, that means the CellEditor must be invoked programatically (through the command handler), though.
Re: Table Viewer - Selecting F2 on the key board does not put the cell into edit mode [message #730038 is a reply to message #730010] Tue, 27 September 2011 10:28 Go to previous message
Eclipse UserFriend
Hi Jérémy,

I didn't quite follow you, did you mean to say that you got the F2 key in table cell editor to work ?

If so, could you please provide a code snippet to show how you achieved this.

Thank you very much.

-- Pavan
Previous Topic:TableViewer - How to force a table column / cell selection when the table widget is loaded
Next Topic:TableViewer setInput() questions
Goto Forum:
  


Current Time: Tue Jul 01 05:33:40 EDT 2025

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

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

Back to the top