package Pm_1148798_freeze_tk_mod; use strict; use warnings; require Tk::BrowseEntry; sub run { my ($class, $script_F, $text_ST, $script_buttons) = @_; my ($yyyy, $mmm, $dd) = ('') x 3; my @years = 2013 .. 2020; my @months = qw{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec}; my @days = map { sprintf '%02d', $_ } 1 .. 31; my $temp_F = $script_F->Frame->pack; my $done_B; my %common_be_opts = ( -state => 'readonly', -autolistwidth => '1', -justify => 'right', -buttontakefocus => 1, -browsecmd => sub { $done_B->configure( -state => $yyyy && $mmm && $dd ? 'normal' : 'disabled' ) } ); my %be_pack_opts = ( -ipadx => 15, -side => 'top', -anchor => 'e', -expand => 1 ); my $y_BE = $temp_F->BrowseEntry(%common_be_opts, -label => 'Select Year', -textvariable => \$yyyy )->pack(%be_pack_opts); $y_BE->insert(end => @years); my $m_BE = $temp_F->BrowseEntry(%common_be_opts, -label => 'Select Month', -textvariable => \$mmm )->pack(%be_pack_opts); $m_BE->insert(end => @months); my $d_BE = $temp_F->BrowseEntry(%common_be_opts, -label => 'Select Day', -textvariable => \$dd )->pack(%be_pack_opts); $d_BE->insert(end => @days); $done_B = $temp_F->Button(-text => 'Done', -state => 'disabled', -command => sub { $text_ST->insert(end => "Selected day: $dd\n" . "Selected month: $mmm\n" . "Selected year: $yyyy\n" ); $temp_F->destroy; $script_F->configure(-height => 1); $_->configure(-state => 'normal') for @$script_buttons; })->pack; } 1;