When you edit a cell in a table then press the enter key the selection box disappears. Then when you press the enter key again the selected row jumps to the first row in the table.
If you use tab instead of enter the selection box moves to the right allowing you to move through the table to continuing editing. If a table only has 1 or 2 columns out of 10 that are editable then tabbing through the entire row is very time consuming. For a user who is good with the ten key and only uses one hand for entry, the tab key is just too far away on the keyboard.
I took the liberty of moving this post to the feature request forum.
So you want the enter key to move downwards? Like the down arrow key does behaves?
I would like to be able to capture the enter keycode when editing a cell. this way I can programmatically tell the selected cell where to go.
Alright, I finally looked into this - you’re right, that behavior is pretty maddening.
Using the observation that the down arrow key seemed much more useful than the enter key, I came up with this workaround. Put this script in the “internalFrameActivated” script for your window (you might need to modify the code that finds the table component). It re-assigns the enter keypress action to do the same thing that the down arrow key does.
[code]import javax, java
table = event.source.rootContainer.getComponent(“Table”).viewport.view
downKey = java.awt.event.KeyEvent.VK_DOWN
enterKey = java.awt.event.KeyEvent.VK_ENTER
downAction = inputMap.get(javax.swing.KeyStroke.getKeyStroke(downKey,0,0))
It seems to work better. It still requires two enter keypresses, but at least it doesn’t jump to the top.
Hope this helps,
Thanks for the reply. It still seems to act the same way. attached is my window. in the product table try to edit either the ending inventory or sales column and then try pressing enter to move down several rows.
EnterKeyOnTableEdit.fwin (79.3 KB)
Try putting this script on the end of your cellEdited event:
# We have to calculate what the “view” column index is
ds = event.source.data
colName = ds.getColumnName(event.column)
col = -1
for i in range(ds.getColumnCount()):
attr = event.source.getColumnAttributes(ds.getColumnName(i))
if not attr.hidden:
col += 1
if col > -1:
The complication here is just due to the fact that your hidden columns make the dataset column index net match with the table’s column index, so the loop calculates the latter using the former.
Thank you very much! I really appreciate it.