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

  1. # NOTE: Derived from ..\blib\lib\Tk\Scrollbar.pm.  Changes made here will be lost.
  2. package Tk::Scrollbar;
  3.  
  4. # tkScrlByUnits --
  5. # This procedure tells the scrollbar's associated widget to scroll up
  6. # or down by a given number of units.  It notifies the associated widget
  7. # in different ways for old and new command syntaxes.
  8. #
  9. # Arguments:
  10. # w -        The scrollbar widget.
  11. # orient -    Which kinds of scrollbars this applies to:  "h" for
  12. #        horizontal, "v" for vertical, "hv" for both.
  13. # amount -    How many units to scroll:  typically 1 or -1.
  14.  
  15. sub ScrlByUnits 
  16. {my $w = shift;
  17.  my $orient = shift;
  18.  my $amount = shift;
  19.  my $cmd    = $w->cget("-command");
  20.  return unless (defined $cmd);
  21.  return if (index($orient,substr($w->cget("-orient"),0,1)) < 0); 
  22.  my @info = $w->get;
  23.  if (@info == 2)
  24.   {
  25.    $cmd->Call("scroll",$amount,"units");
  26.   }
  27.  else
  28.   {
  29.    $cmd->Call($info[2]+$amount);
  30.   }
  31. }
  32.  
  33. 1;
  34.