A typical usage of a listbox in extended selection mode
is the extending of the selection by pressing the
<Shift> button in combination with hitting the <Up> an
<Down> arrow keys or pressing the <B1> mouse button.
The listbox behaviour for these actions is defined in
the proc tk::ListBoxMotion, which can be found in the
file listbox.tcl in the Tk library.
Especially for this specific behaviour, the revised
proc tk::ListBoxMotion below exhibits considerable
improvements in execution speed and display handling.
The revised proc has also been submitted as a patch to
sourceforge. I post it here to c.l.t for those among
the newsgroup readers who want to try it in an early stage.
Sincerely,
Erik Leunissen
--------------
a. Changing the selection on various incontiguous
selected/deselected ranges with <Shift-B1>:
Reduction of execution time in the order of 25 - 33%
(1.33 - 1.5 times faster)
b. Changing (extending/reducing) the selection by a
single item through <Shift-Up>, <Shift-Down> or
dragging the mouse one item with <Shift-B1> pressed:
Reduction of execution time in the order of 50 - 70%
(2 - 3.5 times faster)
c. As in b. but for the special case that the action
doesn't change the selection state of the item under
the pointer:
Reduction of execution time in the order of 99 -
99.3% (100 - 150 times faster)
With respect to cases b and c:
Using the standard Tk bindings for listboxes in
combination with hardware (CPU and video card) that is
nothing special, an item immediately adjacent to the
item that to be (de)selected could be seen to flicker
for a moment. With the revised code, the flicker is gone.
Logged In: YES
user_id=113903
There is one more location in listbox.tcl where the display
handling can be improved. The suplied revision for
tk::ListboxBeginSelect prevents that the selected item
flickers on the display. File attached file
ListboxBeginSelect.tcl holds this revision.
Erik Leunissen