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

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