Hello,
I'm having a little fun playing with perl/tk on an NT4 platform. I seem to be having problems closing Tk::Toplevel windows as part of a -command switch for button widgets. When the add button on the addgroupswindow is pressed, addgroups() is run, but the addgroupswindow toplevel is not destroyed.
use Tk;
use Tk::DialogBox;
use Tk::Dialog;
use Tk::Label;
use Tk::Entry;
use Tk::Tree;
use Win32::Process;
my $Mainwindow = MainWindow->new;
#?
my $firstname = $Mainwindow->Entry
(-width=>30);
$firstname ->grid(-row => 0, -col => 1);
#?
my $groupstouserbutton = $Mainwindow->Button
(-text => "add to groups",
-command => sub { addgroupswindowmaker($firstname)});
$groupstouserbutton ->grid(-row=>19, -col=>1);
#?
my $quitbutton = $Mainwindow->Button
(-text => "Quit",
-command => [$Mainwindow => 'destroy']);
$quitbutton ->grid(-row=>20, -col=>1);
MainLoop;
sub addgroupswindowmaker
{
$addgroupswindow = $Mainwindow->Scrolled(Toplevel,
-scrollbars => 'osoe');
$addgroupswindow->title("Potato");
#?
my $addgroupsbutton = $addgroupswindow->Button
(-text => "Add",
-command => sub { addgroups();$addgroupswindow => 'destroy
+'})->grid(-row=> $k,-col => "1");
my $cancelgroupsbutton = $addgroupswindow->Button
(-text => "Done",
-command => [$addgroupswindow => 'destroy'])->grid(-row=>
+$k,-col => "2");
}
sub addgroups{
#?
}
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.