in reply to Perl TK BrowseEntry error

Thank you all for reply. This is just an example code. The reason I destroy the top_f is because I want to replace with a different screen after the user finish selecting. I think "ldln" is right about the bug in BrowseEntry widge.
Is packForget similar to destroy?.
$top_f->packForget( ) if $top_f->ismapped;

Replies are listed 'Best First'.
Re^2: Perl TK BrowseEntry error
by lamprecht (Friar) on Jan 10, 2010 at 21:48 UTC
    Hi,

    packForget will hide the widget. You can call pack on it to display it again. The instance will stay in memory. Unless you need $top_f again, you could use afterIdle to delay destroying the frame until the Buttons -command-callback has returned:

    $bot_f->Button(-text => "Print value", -command => sub { print "The month is $month\n"; $top->afterIdle(sub{ $top_f->destroy if Tk::Exists($top_f); }); }, -relief => "raised")->pack;

    Cheers, Christoph