home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _d6c18fa4577d61789a21a1af3bd6d881 < prev    next >
Encoding:
Text File  |  2004-06-01  |  1.7 KB  |  62 lines

  1. # NOTE: Derived from ..\blib\lib\Tk\Scale.pm.
  2. # Changes made here will be lost when autosplit is run again.
  3. # See AutoSplit.pm.
  4. package Tk::Scale;
  5.  
  6. #line 203 "..\blib\lib\Tk\Scale.pm (autosplit into ..\blib\lib\auto\Tk\Scale\Increment.al)"
  7. # Increment --
  8. # This procedure is invoked to increment the value of a scale and
  9. # to set up auto-repeating of the action if that is desired. The
  10. # way the value is incremented depends on the "dir" and "big"
  11. # arguments.
  12. #
  13. # Arguments:
  14. # w - The scale widget.
  15. # dir - "up" means move value towards -from, "down" means
  16. # move towards -to.
  17. # big - Size of increments: "big" or "little".
  18. # repeat - Whether and how to auto-repeat the action: "noRepeat"
  19. # means don't auto-repeat, "initial" means this is the
  20. # first action in an auto-repeat sequence, and "again"
  21. # means this is the second repetition or later.
  22. sub Increment
  23. {
  24.  my $w = shift;
  25.  my $dir = shift;
  26.  my $big = shift;
  27.  my $repeat = shift;
  28.  my $inc;
  29.  if ($big eq 'big')
  30.   {
  31.    $inc = $w->cget('-bigincrement');
  32.    if ($inc == 0)
  33.     {
  34.      $inc = abs(($w->cget('-to')-$w->cget('-from')))/10.0
  35.     }
  36.    if ($inc < $w->cget('-resolution'))
  37.     {
  38.      $inc = $w->cget('-resolution')
  39.     }
  40.   }
  41.  else
  42.   {
  43.    $inc = $w->cget('-resolution')
  44.   }
  45.  if (($w->cget('-from') > $w->cget('-to')) ^ ($dir eq 'up'))
  46.   {
  47.    $inc = -$inc
  48.   }
  49.  $w->set($w->get()+$inc);
  50.  if ($repeat eq 'again')
  51.   {
  52.    $w->RepeatId($w->after($w->cget('-repeatinterval'),'Increment',$w,$dir,$big,'again'));
  53.   }
  54.  elsif ($repeat eq 'initial')
  55.   {
  56.    $w->RepeatId($w->after($w->cget('-repeatdelay'),'Increment',$w,$dir,$big,'again'));
  57.   }
  58. }
  59.  
  60. # end of Tk::Scale::Increment
  61. 1;
  62.