diff options
Diffstat (limited to 'Perl/demos/Tk')
-rw-r--r-- | Perl/demos/Tk/demos/zinc_lib/path_tags.pl | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/Perl/demos/Tk/demos/zinc_lib/path_tags.pl b/Perl/demos/Tk/demos/zinc_lib/path_tags.pl index 0ea1619..f9d81fa 100644 --- a/Perl/demos/Tk/demos/zinc_lib/path_tags.pl +++ b/Perl/demos/Tk/demos/zinc_lib/path_tags.pl @@ -48,7 +48,7 @@ $text->pack(-expand => 'yes', -fill => 'both'); $text->insert('0.0', 'This represents a group hierarchy: - groups are represented by a rectangle and a Title. - - non-group items are represtend by a text. + - non-group items are represented by a text. Select a pathTag or a tag with one of the radio-button or experiment your own tags in the input field'); @@ -65,14 +65,18 @@ my $zinc = $mw->Zinc(-width => 850, -height => 360, -font => "10x20", # Creation of a bunch of radiobutton and a text input ########################################### -my $row = $mw->Frame()->pack(); +my $tagsfm = $mw->Frame()->pack(); +my $pathtag; + my @pl = qw/-side left -expand 1 -padx .5c -pady .2c/; -my $left = $row->Frame->pack(@pl); -my $middleleft = $row->Frame->pack(@pl); -my $middleright = $row->Frame->pack(@pl); -my $right = $row->Frame->pack(@pl); +my $left = $tagsfm->Frame->pack(@pl); +my $middle = $tagsfm->Frame->pack(@pl); +my $right = $tagsfm->Frame->pack(@pl); +my $rtop = $right->Frame->pack(-side => 'top'); +my $rbottom = $right->Frame->pack(-side => 'top'); +my $rbot_left = $rbottom->Frame->pack(-side => 'left'); +my $rbot_right = $rbottom->Frame->pack(-side => 'left'); -my $pathtag; @pl = qw/-side top -pady 2 -anchor w/; foreach my $p qw(top .top .top. .top* .top*cca .5.) { $left->Radiobutton(-text => "$p", @@ -84,7 +88,7 @@ foreach my $p qw(top .top .top. .top* .top*cca .5.) { )->pack(@pl); } foreach my $p qw(.top*aa .top*aa. .top*aa* .top*aaa .top*aaa. .5*) { - $middleleft->Radiobutton(-text => "$p", + $middle->Radiobutton(-text => "$p", -font => "10x20", -command => \&displayPathtag, -variable => \$pathtag, @@ -93,27 +97,35 @@ foreach my $p qw(.top*aa .top*aa. .top*aa* .top*aaa .top*aaa. .5*) { )->pack(@pl); } + +$rtop->Label(-font => "10x20", + -relief => 'flat', + -text => 'your own tag :', + )->pack(-side => 'left'); +$rtop->Entry(-font => "10x20", -width => 15)->pack(-side => 'left') + ->bind('<Key-Return>', sub {$pathtag = $_[0]->get(); &displayPathtag}); + + foreach my $p qw(.top*aa*aaa .top*aa*aaa. .top*aa*aaa* .other_top*aa* .5*ca*) { - $middleright->Radiobutton(-text => "$p", - -font => "10x20", - -command => \&displayPathtag, - -variable => \$pathtag, - -relief => 'flat', - -value => $p, - )->pack(@pl); + $rbot_left->Radiobutton(-text => "$p", + -font => "10x20", + -command => \&displayPathtag, + -variable => \$pathtag, + -relief => 'flat', + -value => $p, + )->pack(@pl); } foreach my $p (qw(*aa*aaaa *aaa ) , "aa || ca", qw( none all) ) { - $right->Radiobutton(-text => "$p", - -font => "10x20", - -command => \&displayPathtag, - -variable => \$pathtag, - -relief => 'flat', - -value => $p, - )->pack(@pl); + $rbot_right->Radiobutton(-text => "$p", + -font => "10x20", + -command => \&displayPathtag, + -variable => \$pathtag, + -relief => 'flat', + -value => $p, + )->pack(@pl); } - # creating the item hierarchy $zinc ->add('group', 1, -tags => ['top']); &createSubHierarchy ('top'); |