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

  1. # NOTE: Derived from ..\blib\lib\Tk\Scrollbar.pm.  Changes made here will be lost.
  2. package Tk::Scrollbar;
  3.  
  4. # tkScrollStartDrag --
  5. # This procedure is called to initiate a drag of the slider.  It just
  6. # remembers the starting position of the slider.
  7. #
  8. # Arguments:
  9. # w -        The scrollbar widget.
  10. # x, y -    The mouse position at the start of the drag operation.
  11.  
  12. sub StartDrag
  13. {my $w = shift;
  14.  my $x = shift;
  15.  my $y = shift;
  16.  return unless (defined ($w->cget("-command")));
  17.  $initMouse  = $w->fraction($x,$y);
  18.  @initValues = $w->get();
  19.  if (@initValues == 2)
  20.   {
  21.    $initPos = $initValues[0];
  22.   }
  23.  else
  24.   {
  25.    $initPos = $initValues[2] / $initValues[0];
  26.   }
  27. }
  28.  
  29. 1;
  30.