"Fossies" - the Fresh Open Source Software Archive

Member "Tk-804.036/examples/adj_demo" (15 Nov 2013, 641 Bytes) of package /linux/misc/Tk-804.036.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/local/bin/perl  -w
    2 use Tk;
    3 require Tk::TextUndo;
    4 
    5 use Carp;
    6 
    7 $SIG{__DIE__} = \&Carp::confess;
    8 
    9 my $mw = MainWindow->new;
   10 
   11 
   12 # Uncomment next line to avoid the warning - this a test of the warning
   13 # use Tk::TextUndo;
   14 my $t1 = $mw->Scrolled('TextUndo', -wrap => 'none');
   15 my $lb = $mw->Scrolled('Listbox');
   16 $lb->packAdjust(-side => 'left', -fill => 'both', -delay => 1);
   17 $lb->bind('<Double-ButtonRelease-1>',sub { $t1->Load($lb->getSelected) });
   18 
   19 $t1->pack(-side => 'right', -fill => 'both', -expand => 1);
   20 
   21 opendir(DIR,'.');
   22 my $name;
   23 foreach $name (readdir(DIR))
   24  {
   25   $lb->insert('end',$name) if (-T $name);
   26  }
   27 closedir(DIR);
   28 MainLoop;