aboutsummaryrefslogtreecommitdiff
path: root/Perl/demos/Tk
diff options
context:
space:
mode:
authormertz2003-03-10 13:34:27 +0000
committermertz2003-03-10 13:34:27 +0000
commite2dab53cba238ea4e292c2b2360ed3188ce843ff (patch)
tree1b3a61bc6f000eb6031cbe91676762f8fd577145 /Perl/demos/Tk
parent998d2a9781f76201f85f5924d9236a2cf6736840 (diff)
downloadtkzinc-e2dab53cba238ea4e292c2b2360ed3188ce843ff.zip
tkzinc-e2dab53cba238ea4e292c2b2360ed3188ce843ff.tar.gz
tkzinc-e2dab53cba238ea4e292c2b2360ed3188ce843ff.tar.bz2
tkzinc-e2dab53cba238ea4e292c2b2360ed3188ce843ff.tar.xz
when an item change its grpup, it does not move anymore
the updateLabel sub works again with the pathtags binding to numeric keys of numeric keypad works fine now
Diffstat (limited to 'Perl/demos/Tk')
-rw-r--r--Perl/demos/Tk/demos/zinc_lib/groups_priority.pl9
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);
}