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

  1. # NOTE: Derived from blib\lib\Tk\TextUndo.pm.  Changes made here will be lost.
  2. package Tk::TextUndo;
  3.  
  4. sub Load
  5. {
  6.  my ($text,$file) = @_;
  7.  if (open(FILE,"<$file"))
  8.   {
  9.    $text->MainWindow->Busy;
  10.    $text->SUPER::delete('1.0','end');
  11.    delete $text->{UNDO};
  12.    while (<FILE>)
  13.     {
  14.      $text->SUPER::insert('end',$_);
  15.     }
  16.    close(FILE);
  17.    $text->{FILE} = $file;
  18.    $text->MainWindow->Unbusy;
  19.   }
  20.  else
  21.   {
  22.    $text->BackTrace("Cannot open $file:$!");
  23.   }
  24. }
  25.  
  26. #   Should one add/document a Filename(?$newfilename?) method, or
  27. #   document the $text->{FILE} instance variable, or
  28. #   leave the housekeeping to the programmer?
  29.  
  30. #   We have here no <L4> on our keyboard :-(  So TextUndo needs
  31.  
  32. #    - document the 'undo' method. so other can use Bind
  33. #    - an BindUndo method
  34. #    - or use/document *textUndo.undo resource (defaults
  35. #      to <L4>
  36.  
  37.  
  38. 1;
  39.