home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / auto / Tk / Text / AutoScan.al next >
Encoding:
Text File  |  1997-08-10  |  992 b   |  42 lines

  1. # NOTE: Derived from ..\blib\lib\Tk\Text.pm.  Changes made here will be lost.
  2. package Tk::Text;
  3.  
  4. # AutoScan --
  5. # This procedure is invoked when the mouse leaves a text window
  6. # with button 1 down. It scrolls the window up, down, left, or right,
  7. # depending on where the mouse is (this information was saved in
  8. # tkPriv(x) and tkPriv(y)), and reschedules itself as an "after"
  9. # command so that the window continues to scroll until the mouse
  10. # moves back into the window or the mouse button is released.
  11. #
  12. # Arguments:
  13. # w - The text window.
  14. sub AutoScan
  15. {
  16.  my $w = shift;
  17.  if ($Tk::y >= $w->height)
  18.   {
  19.    $w->yview("scroll",2,"units")
  20.   }
  21.  elsif ($Tk::y < 0)
  22.   {
  23.    $w->yview("scroll",-2,"units")
  24.   }
  25.  elsif ($Tk::x >= $w->width)
  26.   {
  27.    $w->xview("scroll",2,"units")
  28.   }
  29.  elsif ($Tk::x < 0)
  30.   {
  31.    $w->xview("scroll",-2,"units")
  32.   }
  33.  else
  34.   {
  35.    return;
  36.   }
  37.  $w->SelectTo("@" . $Tk::x . ",". $Tk::y);
  38.  $w->RepeatId($w->after(50,"AutoScan",$w));
  39. }
  40.  
  41. 1;
  42.