diff options
Diffstat (limited to 'Perl/demos')
-rw-r--r-- | Perl/demos/Tk/demos/zinc_lib/groups_priority.pl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Perl/demos/Tk/demos/zinc_lib/groups_priority.pl b/Perl/demos/Tk/demos/zinc_lib/groups_priority.pl index d18e71c..580c3dd 100644 --- a/Perl/demos/Tk/demos/zinc_lib/groups_priority.pl +++ b/Perl/demos/Tk/demos/zinc_lib/groups_priority.pl @@ -118,9 +118,12 @@ $zinc->Tk::bind('<KeyPress-minus>' => \&lower); $zinc->Tk::bind('<KeyPress-KP_Subtract>' => \&lower); $zinc->Tk::bind('<KeyPress-t>' => \&toggleItemGroup); +my @KP_MAPPINGS = qw (Insert End Down Next Left Begin Right Home Up Prior); + for my $i (0..9) { $zinc->Tk::bind("<KeyPress-$i>" => [\&setPriorrity, $i]); - $zinc->Tk::bind("<KeyPress-KP_$i>" => [\&setPriorrity, $i]); + my $code = $KP_MAPPINGS[$i]; + $zinc->Tk::bind("<KeyPress-KP_$code>" => [\&setPriorrity, $i]); } # The following binding is currently not possible; only text items @@ -134,7 +137,7 @@ sub updateLabel { my ($group) = @_; my $priority = $zinc->itemcget($group, -priority); # we get the text item from this group: - my $textitem = $zinc->find('withtype', 'text', $group); + my $textitem = $zinc->find('withtype', 'text', ".$group."); $zinc->itemconfigure($textitem, -text => "pri=$priority"); } @@ -202,7 +205,7 @@ sub toggleItemGroup { $newgroup = $group1; } - $zinc->chggroup($item,$newgroup); + $zinc->chggroup($item,$newgroup,1); ## the lats argument is true for mainting $item' position &updateLabel($item); } |