Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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:
Then I get the error:
--- Begin Traceback --- Failed to AUTOLOAD 'Tk::Frame::gridRemove' at line 437 Carp::croak at K:/Perl/lib/ line 191 Tk::Widget::__ANON__ at K:/Perl/site/lib/Tk/ line 338 main::doImportFile at line 437 [\&main::doImportFile,{},{},{}] Tk callback for .notebook.page4.button1 Tk::__ANON__ at K:/Perl/site/lib/ line 228 Tk::Button::butUp at K:/Perl/site/lib/Tk/ line 111 (command bound to event)
Does any one have a suggestion to offer about how to remove the button from the window?


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

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

  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (5)
    As of 2021-01-17 19:45 GMT
    Find Nodes?
      Voting Booth?