#!/usr/bin/perl -w
######################################################################
# (c) Michael Schilli 1999
######################################################################

use Tk;

my $top = MainWindow->new();

my $frame = $top->Frame();

my $text = $frame->Text(-wrap => 'none');

                               # Scrollbars definieren
my $yscrollbar = $frame->Scrollbar(-command => 
                                   [yview => $text]);
my $xscrollbar = $top->Scrollbar(-orient => 'horizontal', 
                                 -command => [xview => $text]);

                               # ... und setzen
$text->configure(-yscrollcommand => [set => $yscrollbar]);
$text->configure(-xscrollcommand => [set => $xscrollbar]);

                               # Alles packen
$yscrollbar->pack(-side => 'right', -fill => 'y');
$xscrollbar->pack(-side => 'bottom', -fill => 'x');

$frame->pack(-expand => 'yes', -fill => 'both');
$text->pack(-expand => 'yes', -fill => 'both', 
            -side => 'left');


foreach $row (1..30) {         # 30 Zeilen einfügen
    $text->insert("end", "Zeile $row\n");
}

# Dritte Zeile löschen
$text->delete("3.0", "4.0");

# Neue dritte Zeile einfügen
$text->insert("3.0", "Text der neuen dritten Zeile\n");

# Vierte und fünfte Zeile vertauschen

$line4 = $text->get("4.0", "5.0");          # 4. Zeile holen
$line5 = $text->get("5.0", "6.0");          # 5. Zeile holen
$text->delete("4.0", "6.0");                # 4. und 5. Zeile 
                                            # löschen
$textstring = $text->insert("4.0", $line5); # Neue 4. Zeile 
                                            # einfügen
$textstring = $text->insert("5.0", $line4); # Neue 5. Zeile 
                                            # einfügen

MainLoop;

