Am 12.04.21 um 22:03 schrieb Alan Grunwald:
The default bindings for tablelist widgets handle the active item and
the selection in *exactly* the same way as those for listbox widgets.
The rules below are valid for the default selection mode "browse" and
selection type "row":
- The selection is changed (and the <<TablelistSelect>> virtual event is
sent) as a result of a <Button-1> event.
- The active item is changed by a <ButtonRelease-1> event.
- The Up and Down keys change both the active item and the selection
(and generate the <<TablelistSelect>> virtual event).
From the above it follows that it is not safe to use [.tablelist index
active] in a script bound to the <Button-1> event or to the
<<TablelistSelect>> virtual event. In a script bound to the <Button-1>
event you can use the nearest subcommand instead, like in the example below:
bind [.tablelist bodytag] <Button-1> {printClickedRow %W %x %y}
proc printClickedRow {w x y} {
foreach {tbl x y} [tablelist::convEventFields $w $x $y] {}
puts "clicked on row [$tbl nearest $y]"
}
To your concern regarding the event order: It is extremely unlikely
that Tablelist might change the order in which the events are delivered.
BTW: The simplest way to react on changes of the active item is to use
my Wcb package.
--
Csaba Nemethi
https://www.nemethi.de mailto:
csaba....@t-online.de