Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Make table editor behave more like Excel? (Is it possible to make a table editor work Excel style? )
Make table editor behave more like Excel? [message #987605] Tue, 27 November 2012 05:14 Go to previous message
Torbjörn Karlsson is currently offline Torbjörn Karlsson
Messages: 1
Registered: November 2012
Junior Member
Is it possible to make a table editor work like this, Excel style?

1. Start typing in an editable cell edits the cell
2. Pressing enter while standing on an editable cell opens the cell editor
3. Start typing in a cell (or pressing enter) that is not editable does nothing
4. Double-click opens the cell editor, like 2 above
5. Moving around in the table can be done with the arrow-keys, mouse or TAB (see no 6.)
6. Pressing TAB while standing on a cell moves to the next cell, SHIFT-TAB moves to the previous cell
7. Pressing enter in an open cell editor accepts the value and selects the current cell
8. Pressing tab in an open cell editor accepts the value and selects the next cell (but does not open the cell editor, if there is one)
9. Pressing escape in an open cell editor disregards the value and selects the current cell
10. Pressing tab in the last editable cell in the table should select the next available cell (if there is one, if not the current cell should be selected)
11. Pressing tab in the very last cell (the last cell is editable) should accept the value and select the current (last) cell
12. Item 10 and 11 should also work in the first editable cell and pressing SHIFT-TAB

Number 2, 3, 4, 5, 7, 9 are fairly simple and works more or less out of the box. It is the rest I need help with...

1.
Open the cell editor is fairly simple, but how do I save the value the user typed? If the user types the key "s" it should be the same as if the user pressed F2 (the activation key) followed by a "s". We are building a toolkit, so we can´t use TableItem.setData(Object) since we don´t know what type of data that backs up the table.

6.
Pressing TAB with no active cell editor moves focus to the next part of the workbench.

8.
I can make this work, with the exception seen in numbers 10, 11 and 12. My solution involved a addEditorActivationListener#beforeEditorActivated that canceled the current event (the current event would be the activation of the next cell editor) and created a new SWT.KeyDown event using keyCode == SWT.ARROW_RIGHT if the user pressed the TAB key. This does feel like a hack and does only work if there is another cell editor to traverse to. So it does not work for cases described in 10, 11 and 12.

10, 11 and 12.
I really have no idea how to solve these.

Any help appreciated,

/Torbjörn
 
Read Message
Read Message
Previous Topic:What is gtk_main_do_event doing?
Next Topic:Disabling the tool bar in a PDFViewer (PDFRenderer)
Goto Forum:
  


Current Time: Sun May 19 18:46:51 EDT 2013

Powered by FUDForum. Page generated in 0.01813 seconds