use Tk;
use Tk::SearchEntry;
my $main = MainWindow->new;
$w = $main->Scrolled(
'SearchEntry', #custom widget
-scrollbars => '',
-width => 70,
-height => 1,
-bg => "#ffffff",
)->grid(
-sticky => 'w',
-row => 1,
-column => 0,
-padx => 5,
-pady => 1,
);
$w->configure(qw/-height 10 -bg blue -fg white/);
MainLoop;
####
use Tk;
use Tk::SearchEntry;
my $main = MainWindow->new;
$w = $main->Scrolled(
'SearchEntry', #custom widget
-scrollbars => '',
-width => 70,
-height => 1,
-bg => "#ffffff",
)->grid(
-sticky => 'w',
-row => 1,
-column => 0,
-padx => 5,
-pady => 1,
);
$main->Button(
-text => "Change",
-command => sub {
$w->configure(-width => 10, -height => 10);
})->grid;
MainLoop;
####
use Tk;
use Tk::SearchEntry;
my $main = MainWindow->new;
$w = $main->Scrolled(
'SearchEntry', #custom widget
-scrollbars => '',
-width => 70,
-height => 1,
-bg => "#ffffff",
)->grid(
-sticky => 'w',
-row => 1,
-column => 0,
-padx => 5,
-pady => 1,
);
$main->Button(
-text => "Change",
-command => sub {
## allow subwidget to exert control over the size
$w->packPropagate(1);
$w->configure(-width => 10, -height => 10);
## This line resets it back, but only after
## the change has taken place. You don't *have*
## to reset packPropagate to 0, but be aware that
## it will reset itself, each time the widget is
## mapped.
$w->afterIdle([$w, 'packPropagate', 0]);
})->grid;
$main->Button(
-text => "Change2",
-command => sub {
$w->configure(-width => 30, -height => 2);
})->grid;
MainLoop;