aboutsummaryrefslogtreecommitdiff
path: root/Perl/demos/Tk/demos/zinc_lib/labelformat.pl
diff options
context:
space:
mode:
Diffstat (limited to 'Perl/demos/Tk/demos/zinc_lib/labelformat.pl')
-rw-r--r--Perl/demos/Tk/demos/zinc_lib/labelformat.pl20
1 files changed, 11 insertions, 9 deletions
diff --git a/Perl/demos/Tk/demos/zinc_lib/labelformat.pl b/Perl/demos/Tk/demos/zinc_lib/labelformat.pl
index 5587a4e..9cb1fcb 100644
--- a/Perl/demos/Tk/demos/zinc_lib/labelformat.pl
+++ b/Perl/demos/Tk/demos/zinc_lib/labelformat.pl
@@ -21,8 +21,8 @@ $text->pack(qw/-expand yes -fill both/);
$text->insert('0.0',
'This toy-appli demonstrates the use of labelformat for tabular items.
The fieldPos (please, refer to the "labelformat type" description
-in the "Zinc reference manual") of each fields as described in
-the the labelformat is displayed inside the field.');
+in the "Zinc reference manual") of each field as described in
+the labelformat is displayed inside the field.');
###########################################
@@ -56,23 +56,23 @@ are given in pixels");
my $labelformat2 = "300x300 x110x20+100+30 x80x20<0<0 x80x20<0>0 x80x20>0>0 x80x20>0<0";
my $tabular2 = $zinc->add('tabular',1, 5,
- -position => [300,10],
+ -position => [270,10],
-labelformat => $labelformat2,
);
&setLabelContent ($tabular2,$labelformat2);
-$zinc->add('text', 1, -position => [270,100], -text =>
+$zinc->add('text', 1, -position => [260,100], -text =>
"All fields positions are given
relatively to field 0.
-They are either on the left /
-right and up/down the field 0.");
+They are either on the left/right
+and up/down the field 0.");
### third labelformat and tabular
-my $labelformat3 = "300x300 x200x20+50+40 x80x20^0<0 x80x20^0>0 x80x20\$0>0 x80x20\$0<0 x90x20\$1<1 x90x20\$2>2 x90x20^4<4 x90x20^3>3";
+my $labelformat3 = "400x300 x200x70+100+70 x80x26^0<0 x80x26^0>0 x80x29\$0\$0 x80x32\$0^0 x90x20\<1^1 x90x20<2\$2 x90x20^4<4 x90x20^3>3";
my $tabular3 = $zinc->add('tabular',1, 9,
- -position => [150,250],
+ -position => [150,180],
-labelformat => $labelformat3,
);
&setLabelContent ($tabular3,$labelformat3);
@@ -84,6 +84,8 @@ Field 6 is positionned relatively to field 2..."
);
+### this function displays in each field, the corresponding <fieldPos>
+### part of the labelformat
sub setLabelContent {
my ($item,$labelformat) = @_;
@@ -92,7 +94,7 @@ sub setLabelContent {
my $i=0;
foreach my $fieldSpec (@fieldsSpec) {
- my ($posSpec) = $fieldSpec =~ /\d+.?\d+(.*)/ ;
+ my ($posSpec) = $fieldSpec =~ /^.\d+.\d+(.*)/ ;
# print "$fieldSpec\t$i\t$posSpec\n";
$zinc->itemconfigure ($item,$i,
-text => "$i: $posSpec",