Esteemed Monks,
In the following code a button is placed in a grid inside a frame inside a NoteBook tab.
sub doFileImportUi {
my ($pg, $dbh) = @_;
$pg->Label(-text => 'File', -width => '10')->grid(
$pg->LabEntry(-width => '30', -textvariable => \$state->{ImpFi
+le}), $pg->Button(-text => 'Browse', -command => [ \&getImportFile, $
+pg, $dbh], -width => '10'));
$pg->Label(-text => 'DataSource', -justify => 'right', -width => '
+20')
->grid(my $ds_list = $pg->BrowseEntry(-variable => \$state
+->{dsSrcName}, -browsecmd => \&doGetDatasource, -listcmd => [ \&doLoa
+dDs, $pg, $dbh ], -width => '20'), -sticky => 'w');
my $gbtn = $pg->Button(-text => 'Next Phase')->grid();
$gbtn->configure( -command => [ \&doImportFile, $pg, $dbh, $gbtn
+]);
my @listname = &doLoadDs($pg, $dbh);
$ds_list->insert('end', @listname);
}
When I click on that button and go to the doImportFile() sub I want to remove the button. According to the grid manpage it is possible, but if I use this code, which seems plausible according to the manpage:
$pg->gridRemove($gbtn);
Then I get the error:
--- Begin Traceback ---
Failed to AUTOLOAD 'Tk::Frame::gridRemove' at start3.pl line 437
Carp::croak at K:/Perl/lib/Carp.pm line 191
Tk::Widget::__ANON__ at K:/Perl/site/lib/Tk/Widget.pm line 338
main::doImportFile at start3.pl line 437
[\&main::doImportFile,{},{},{}]
Tk callback for .notebook.page4.button1
Tk::__ANON__ at K:/Perl/site/lib/Tk.pm line 228
Tk::Button::butUp at K:/Perl/site/lib/Tk/Button.pm line 111
(command bound to event)
Does any one have a suggestion to offer about how to remove the button from the window?
jdtoronto
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, 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, 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.