diff options
author | mertz | 2002-04-12 14:29:21 +0000 |
---|---|---|
committer | mertz | 2002-04-12 14:29:21 +0000 |
commit | b05097e9938fe2f6ade661127f739dc4fc773f11 (patch) | |
tree | da833d328f44cce8f5c6f7f6938b6a75e98b2436 /Perl/demos/Tk/demos/zinc_lib/labelformat.pl | |
parent | 3a42a2ae160d6b14f8c58087546c07a9cc16fd9d (diff) | |
download | tkzinc-b05097e9938fe2f6ade661127f739dc4fc773f11.zip tkzinc-b05097e9938fe2f6ade661127f739dc4fc773f11.tar.gz tkzinc-b05097e9938fe2f6ade661127f739dc4fc773f11.tar.bz2 tkzinc-b05097e9938fe2f6ade661127f739dc4fc773f11.tar.xz |
ajout du reticule dans items
exemples de labelformat + explicites
Diffstat (limited to 'Perl/demos/Tk/demos/zinc_lib/labelformat.pl')
-rw-r--r-- | Perl/demos/Tk/demos/zinc_lib/labelformat.pl | 20 |
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", |