Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tablelist cell edit and selection

25 views
Skip to first unread message

Juge

unread,
Jan 23, 2018, 6:32:38 AM1/23/18
to
I am implementing an edit feature to my table where I select multiple rows and
edit a cell on one of them. Afterwards I want to have the edited values on all of the same cells (column) of the other selected rows.

I get it more or less working, however, I have couple of small glitches where I am not sure I can configure it away.

Firstly, when I select multiple rows with selecttype being extended, after clicking on the editable cell, I loose the selection.

Also for a full editable table I would rather start the editing only after double click on the edit cell, but I get an immediate editwindow, this is sometimes a little bit irritating, particularly when I do not wish to edit the cells I would only like to select the rows.

Is there a way to configure this behaviour somehow?

Juge

unread,
Jan 23, 2018, 6:58:50 AM1/23/18
to
Ok, I was able to achieve something with binds.
I made cells -editable 0

and then:
set InputbodyTag [$mytbl bodytag]
bind $InputbodyTag <Double-B1-ButtonRelease> [list StartEdit %W %x %y]

and with:
proc StartEdit {w x y} {
foreach {tbl x y} [tablelist::convEventFields $w $x $y] {}
set col [lindex [split [$tbl containingcell $x $y] ","] 1]
set row [lindex [split [$tbl containingcell $x $y] ","] 0]
$tbl cellconfigure $row,$col -editable 1
$tbl editcell $row,$col
}

and editendcommand:
proc EditValidate {tbl row col text} {
$tbl cellconfigure $row,$col -editable 0
if {[llength [$tbl curselection]] > 1} {
foreach row [$tbl curselection] {
$tbl cellconfigure $row,$col -text $text
}
}
return $text
}

additionally I needed the -forceeditendcommand 1 in the table definition.
The only remaining problem is that the first click of the double-click influences the selection and deselects the multi-selection. I can influence this by using CTRL simultaneously with double click...
0 new messages