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

  1. # NOTE: Derived from ..\blib\lib\Tk\Scale.pm.  Changes made here will be lost.
  2. package Tk::Scale;
  3.  
  4. # ButtonDown --
  5. # This procedure is invoked when a button is pressed in a scale. It
  6. # takes different actions depending on where the button was pressed.
  7. #
  8. # Arguments:
  9. # w - The scale widget.
  10. # x, y - Mouse coordinates of button press.
  11. sub ButtonDown
  12. {
  13.  my $w = shift;
  14.  my $x = shift;
  15.  my $y = shift;
  16.  $Tk::dragging = 0;
  17.  $el = $w->identify($x,$y);
  18.  return unless ($el);
  19.  if ($el eq "trough1")
  20.   {
  21.    $w->Increment("up","little","initial")
  22.   }
  23.  elsif ($el eq "trough2")
  24.   {
  25.    $w->Increment("down","little","initial")
  26.   }
  27.  elsif ($el eq "slider")
  28.   {
  29.    $Tk::dragging = 1;
  30.    my @coords = $w->coords();
  31.    $Tk::deltaX = $x-$coords[0];
  32.    $Tk::deltaY = $y-$coords[1];
  33.   }
  34. }
  35.  
  36. 1;
  37.