home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / auto / Tk / Scrollbar / Select.al < prev    next >
Encoding:
Text File  |  1997-08-10  |  1.4 KB  |  56 lines

  1. # NOTE: Derived from ..\blib\lib\Tk\Scrollbar.pm.  Changes made here will be lost.
  2. package Tk::Scrollbar;
  3.  
  4. # tkScrollSelect --
  5. # This procedure is invoked when button 1 is pressed over the scrollbar.
  6. # It invokes one of several scrolling actions depending on where in
  7. # the scrollbar the button was pressed.
  8. #
  9. # Arguments:
  10. # w -        The scrollbar widget.
  11. # element -    The element of the scrollbar that was selected, such
  12. #        as "arrow1" or "trough2".  Shouldn't be "slider".
  13. # repeat -    Whether and how to auto-repeat the action:  "noRepeat"
  14. #        means don't auto-repeat, "initial" means this is the
  15. #        first action in an auto-repeat sequence, and "again"
  16. #        means this is the second repetition or later.
  17.  
  18. sub Select 
  19. {
  20.  my $w = shift;
  21.  my $element = shift;
  22.  my $repeat  = shift;
  23.  return unless defined ($element);
  24.  if ($element eq "arrow1")
  25.   {
  26.    $w->ScrlByUnits("hv",-1);
  27.   }
  28.  elsif ($element eq "trough1")
  29.   {
  30.    $w->ScrlByPages("hv",-1);
  31.   }
  32.  elsif ($element eq "trough2")
  33.   {
  34.    $w->ScrlByPages("hv", 1);
  35.   }
  36.  elsif ($element eq "arrow2")
  37.   {
  38.    $w->ScrlByUnits("hv", 1);
  39.   }
  40.  else
  41.   {
  42.    return;
  43.   }
  44.  
  45.  if ($repeat eq "again")
  46.   {
  47.    $w->RepeatId($w->after($w->cget("-repeatinterval"),["Select",$w,$element,"again"]));
  48.   }
  49.  elsif ($repeat eq "initial")
  50.   {
  51.    $w->RepeatId($w->after($w->cget("-repeatdelay"),["Select",$w,$element,"again"]));
  52.   }
  53. }
  54.  
  55. 1;
  56.