diff options
Diffstat (limited to 'Master/tlpkg/tlperl/site/lib/Tk/demos/widget_lib/spin.pl')
-rw-r--r-- | Master/tlpkg/tlperl/site/lib/Tk/demos/widget_lib/spin.pl | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl/site/lib/Tk/demos/widget_lib/spin.pl b/Master/tlpkg/tlperl/site/lib/Tk/demos/widget_lib/spin.pl new file mode 100644 index 00000000000..f9b8c05a891 --- /dev/null +++ b/Master/tlpkg/tlperl/site/lib/Tk/demos/widget_lib/spin.pl @@ -0,0 +1,36 @@ +# spin.pl + +use vars qw/$TOP/; + +sub spin { + + # This demonstration script creates several spinbox widgets. + + my($demo) = @_; + $TOP = $MW->WidgetDemo( + -name => $demo, + -text => ['Three different spin-boxes are displayed below. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For values that are too large to fit in the window all at once, you can scan through the value by dragging with mouse button2 pressed. Note that the first spin-box will only permit you to type in integers, and the third selects from a list of Australian cities.', + -wraplength => '5i'], + -title => 'Spinbox Demonstration', + -iconname => 'spin', + ); + + my $s1 = $TOP->Spinbox( + qw/-from 1 -to 10 -width 10 -validate key/, + -validatecommand => sub { + my ($proposed, $changes, $current, $index, $type) = @_; + return not $proposed =~ m/[^\d]/g; + }, + ); + my $s2 = $TOP->Spinbox( + qw/-from 0 -to 3 -increment .5 -format %05.2f -width 10/, + ); + my $s3 = $TOP->Spinbox( + -values => [qw/Canberra Sydney Melbourne Perth Adelaide Brisbane Hobart + Darwin/, 'Alice Springs'], + -width => 10, + ); + + $s1->pack($s2, $s3, qw/-side top -pady 5 -padx 10/); + +} # end spin.pl |