| 1 | # NOTE: Derived from ../blib/lib/Tk/Listbox.pm. |
| 2 | # Changes made here will be lost when autosplit is run again. |
| 3 | # See AutoSplit.pm. |
| 4 | package Tk::Listbox; |
| 5 | |
| 6 | #line 437 "../blib/lib/Tk/Listbox.pm (autosplit into ../blib/lib/auto/Tk/Listbox/Cancel.al)" |
| 7 | # Cancel |
| 8 | # |
| 9 | # This procedure is invoked to cancel an extended selection in |
| 10 | # progress. If there is an extended selection in progress, it |
| 11 | # restores all of the items between the active one and the anchor |
| 12 | # to their previous selection state. |
| 13 | # |
| 14 | # Arguments: |
| 15 | # w - The listbox widget. |
| 16 | sub Cancel |
| 17 | { |
| 18 | my $w = shift; |
| 19 | if ($w->cget('-selectmode') ne 'extended' || !defined $Prev) |
| 20 | { |
| 21 | return; |
| 22 | } |
| 23 | $first = $w->index('anchor'); |
| 24 | $last = $Prev; |
| 25 | if ($first > $last) |
| 26 | { |
| 27 | $tmp = $first; |
| 28 | $first = $last; |
| 29 | $last = $tmp |
| 30 | } |
| 31 | $w->selectionClear($first,$last); |
| 32 | while ($first <= $last) |
| 33 | { |
| 34 | if (Tk::lsearch(\@Selection,$first) >= 0) |
| 35 | { |
| 36 | $w->selectionSet($first) |
| 37 | } |
| 38 | $first += 1 |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | # end of Tk::Listbox::Cancel |
| 43 | 1; |