home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2004 July / APC0407D2.iso / workshop / apache / files / ActivePerl-5.6.1.638-MSWin32-x86.msi / _8aff06f8f24f5bdded64adaeef5da6f2 < prev    next >
Encoding:
Text File  |  2004-04-13  |  1.4 KB  |  67 lines

  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 527 "..\blib\lib\Tk\Listbox.pm (autosplit into ..\blib\lib\auto\Tk\Listbox\Motion.al)"
  7. # Motion --
  8. #
  9. # This procedure is called to process mouse motion events while
  10. # button 1 is down. It may move or extend the selection, depending
  11. # on the listbox's selection mode.
  12. #
  13. # Arguments:
  14. # w - The listbox widget.
  15. # el - The element under the pointer (must be a number).
  16. sub Motion
  17. {
  18.  my $w = shift;
  19.  my $el = shift;
  20.  if (defined($Prev) && $el == $Prev)
  21.   {
  22.    return;
  23.   }
  24.  $anchor = $w->index('anchor');
  25.  my $mode = $w->cget('-selectmode');
  26.  if ($mode eq 'browse')
  27.   {
  28.    $w->selectionClear(0,'end');
  29.    $w->selectionSet($el);
  30.    $Prev = $el;
  31.   }
  32.  elsif ($mode eq 'extended')
  33.   {
  34.    $i = $Prev;
  35.    if ($w->selectionIncludes('anchor'))
  36.     {
  37.      $w->selectionClear($i,$el);
  38.      $w->selectionSet('anchor',$el)
  39.     }
  40.    else
  41.     {
  42.      $w->selectionClear($i,$el);
  43.      $w->selectionClear('anchor',$el)
  44.     }
  45.    while ($i < $el && $i < $anchor)
  46.     {
  47.      if (Tk::lsearch(\@Selection,$i) >= 0)
  48.       {
  49.        $w->selectionSet($i)
  50.       }
  51.      $i += 1
  52.     }
  53.    while ($i > $el && $i > $anchor)
  54.     {
  55.      if (Tk::lsearch(\@Selection,$i) >= 0)
  56.       {
  57.        $w->selectionSet($i)
  58.       }
  59.      $i += -1
  60.     }
  61.    $Prev = $el
  62.   }
  63. }
  64.  
  65. # end of Tk::Listbox::Motion
  66. 1;
  67.