Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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


In reply to Perl/Tk widget removal problem... by jdtoronto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2023-03-28 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (68 votes). Check out past polls.

    Notices?