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

  1. # NOTE: Derived from ..\blib\lib\Tk\Entry.pm.  Changes made here will be lost.
  2. package Tk::Entry;
  3.  
  4. # KeySelect
  5. # This procedure is invoked when stroking out selections using the
  6. # keyboard. It moves the cursor to a new position, then extends
  7. # the selection to that position.
  8. #
  9. # Arguments:
  10. # w - The entry window.
  11. # new - A new position for the insertion cursor (the cursor hasn't
  12. # actually been moved to this position yet).
  13. sub KeySelect
  14. {
  15.  my $w = shift;
  16.  my $new = shift;
  17.  if (!$w->selection("present"))
  18.   {
  19.    $w->selection("from","insert");
  20.    $w->selection("to",$new)
  21.   }
  22.  else
  23.   {
  24.    $w->selection("adjust",$new)
  25.   }
  26.  $w->icursor($new);
  27.  $w->SeeInsert;
  28. }
  29.  
  30. 1;
  31.