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

  1. # NOTE: Derived from ..\blib\lib\Tk\Text.pm.  Changes made here will be lost.
  2. package Tk::Text;
  3.  
  4. # Button1 --
  5. # This procedure is invoked to handle button-1 presses in text
  6. # widgets. It moves the insertion cursor, sets the selection anchor,
  7. # and claims the input focus.
  8. #
  9. # Arguments:
  10. # w - The text window in which the button was pressed.
  11. # x - The x-coordinate of the button press.
  12. # y - The x-coordinate of the button press.
  13. sub Button1
  14. {
  15.  my $w = shift;
  16.  my $x = shift;
  17.  my $y = shift;
  18.  $Tk::selectMode = "char";
  19.  $Tk::mouseMoved = 0;
  20.  $w->mark("set","insert","@".$x.",".$y);
  21.  $w->mark("set","anchor","insert");
  22.  if ($w->cget("-state") eq "normal")
  23.   {
  24.    $w->focus()
  25.   }
  26.  $w->tag("remove","sel","0.0","end");
  27. }
  28.  
  29. 1;
  30.