If you run the following code in Perl then you will get a tree structure.
How do you make it possible for the user to copy and paste the text in the tree?
#!/usr/bin/perl
use Tk;
use Tk::Tree;
my $mw = MainWindow->new(-title => 'Tree', -width => 750, -height=>500);
my $tree = $mw->Tree(font => 'Courier 14', wideselection => 0,
background => white, selectbackground => grey)->place(-x => 0, -y =>
0, -width => 10000, -height => 1000);
my $text = $mw->Text(qw/-width 10 -height 10/);#->pack();
$text->insert('end', "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
$tree->add("1", -text => "Perl Developers Guide");
$tree->add("1.1", -text => "Getting Started");
$tree->add("1.1.1", -text => "Before we start");
$tree->add("1.1.1.1", -text => "Why this guide");
$tree->add("1.1.1.1.1", -text => "The books usually have a lot of
extra and useless information, the reading of which wastes programmers
time.
By using my glossaries you will acquire Perl knowledge with less time
wasted than by reading the books.");
$tree->add("1.2", -text => "Variables");
$tree->add("1.3", -text => "Arrays");
$tree->add("1.4", -text => "Hashes");
$tree->add("1.5", -text => "References");
$tree->add("1.6", -text => "Loops");
$tree->add("1.7", -text => "Functions");
$tree->add("1.8", -text => "Modules");
$tree->add("1.9", -text => "Files");
$tree->add("1.10", -text => "Directories");
$tree->add("1.11", -text => "Text Manipulation");
$tree->add("1.12", -itemtype => 'imagetext', -text => "Miscellaneous");
$tree->itemCreate("1.12", 0, -text => "Hemmi");
$tree->autosetmode();
$tree->close("1.1");
MainLoop; |