1
#!/usr/local/bin/perl -w
5
# $Id: 1.pl,v 1.8 1998/08/28 00:41:44 eserte Exp $
8
# Copyright (C) 1997,1998 Slaven Rezic. All rights reserved.
9
# This program is free software; you can redistribute it and/or
10
# modify it under the same terms as Perl itself.
12
# Mail: eserte@cs.tu-berlin.de
13
# WWW: http://user.cs.tu-berlin.de/~eserte/
20
my $top = new MainWindow;
22
my($foo, $bla, $blubber);
24
my $f = $top->Frame->grid(-row => 0, -column => 0, -sticky => 'n');
25
my $lb = $top->Scrolled('Listbox', -scrollbars => 'osoe'
26
)->grid(-row => 0, -column => 1);
27
$f->Label(-text => 'HistEntry')->pack;
28
my $b = $f->HistEntry(-textvariable => \$foo)->pack;
29
my $bb = $f->Button(-text => 'Add current',
33
$lb->delete(0, 'end');
34
foreach ($b->history) {
35
$lb->insert('end', $_);
40
$f->Button(-text => 'Replace history',
42
$b->history([keys %ENV]);
45
$b->bind('<Return>' => sub { $bb->invoke });
47
my $f2 = $top->Frame->grid(-row => 1, -column => 0, -sticky => 'n');
48
my $lb2 = $top->Scrolled('Listbox', -scrollbars => 'osoe'
49
)->grid(-row => 1, -column => 1);
50
$f2->Label(-text => 'HistEntry with invoke, limit ...')->pack;
52
$b2 = $f2->HistEntry(-textvariable => \$bla,
54
-label => 'Test label',
55
-labelPack => [-side => 'left'],
62
# automatic historyAdd
63
$lb2->delete(0, 'end');
64
foreach ($b2->history) {
65
$lb2->insert('end', $_);
70
#XXX$b2->configure(-match => 1);#XXX
71
$f2->Button(-text => 'Add current',
72
-command => sub { $b2->invoke })->pack;
74
my $f3 = $top->Frame->grid(-row => 2, -column => 0, -sticky => 'n');
75
my $lb3 = $top->Scrolled('Listbox', -scrollbars => 'osoe'
76
)->grid(-row => 2, -column => 1);
77
$f3->Label(-text => 'SimpleHistEntry')->pack;
78
my $b3 = $f3->SimpleHistEntry(-textvariable => \$blubber,
80
my($w, $line, $added) = @_;
82
$lb3->insert('end', $line);
87
$f3->Button(-text => 'Add current',
88
-command => sub { $b3->invoke })->pack;
92
# my $autodestroy_text = "Autodestroy in " . $seconds . "s\n";
93
# $top->Label(-textvariable => \$autodestroy_text,
94
# )->grid(-row => 99, -column => 0, -columnspan => 2);
95
# $top->repeat(1000, sub { if ($seconds <= 0) { $top->destroy }
97
# $autodestroy_text = "Autodestroy in " . $seconds
101
$top->Button(-text => 'Exit',
102
-command => sub { $top->destroy },
103
)->grid(-row => 99, -column => 0, -columnspan => 2);