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

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