Dear Monks,
I need your help regarding the use of Tk::Minicalendar in one of my application. I have several instances where the dates are required to enter dates for some application. Now, I am trying to create a separate subroutine to retrieve the dates. Of all the widgets that I have come across so far, Tk::Minicalendar has caught my attention for its more appaling interface.
However, when I try to create a separate sub for this widget, I encounter a problem. I am not able to return selected dates through the function callback. For some reason, the selected date is not returned. I know I am going wrong somewhere, just don't know where. Here is a sample code
use Tk;
use Tk::MiniCalendar;
use strict;
my $date_sel = dates();
print $date_sel;
MainLoop;
sub dates{
my $out_date;
my $top = MainWindow->new;
my $frm1 = $top->Frame->pack; # Frame to place MiniCalendar in
my $minical = $frm1->MiniCalendar->pack;
my $frm2 = $top->Frame->pack; # Frame for Ok Button
my $b_ok = $frm2->Button(-text => "Ok",
-command => sub {
my ($year, $month, $day) = $minical->date;
$out_date = "$day-$month-$year";
exit;
},
)->pack;
return $out_date;
}
Thanks in advance for your help .. :)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.