Re: tablelist: <Return> the same as <Tab> when editing.



Óscar Fuentes schrieb:
With the code below, when we are editing a cell, pressing <Tab>
terminates the edition, moves to the next editable cell and edits it.

I want to do that with the <Return> key.

After much trial and error (too much to mention) and turned very
confused about TableListEdit, TableListBody, etc, it is time to ask the
experts.

package require tablelist
set table [tablelist::tablelist .gr -stripebackground #e0e8f0 \
-columns {30 "One" \
10 "Two" right 10 "Three" right \
10 "Four" right 10 "Five" right} \
-selecttype cell -selectmode browse \
]
pack $table -expand true -fill both
foreach c { 1 2 3 4 } { $table columnconfigure $c -editable 1 }
foreach c { 1 2 3 4 } { $table insert end [list 1 2 3 4 5] }


You have to redefine the bindings as follows:

# Enforce the activation of the default bindings
tablelist::defineTablelistEdit

# Make sure <Return> will behave like <Tab>
bind TablelistEdit <Return> { tablelist::goToNextPrevCell %W 1 }

--
Csaba Nemethi http://www.nemethi.de mailto:csaba.nemethi@xxxxxxxxxxx
.