gri6507 has asked for the wisdom of the Perl Monks concerning the following question:

Thanks to Merlyn's suggestion, I tried using Tk::grid geometry manager. It is working great except that I can't figure out how to remove something from the grid so that it could be re-grid-ed later. Here's a sample code.
use strict; use Tk; require Tk::BrowseEntry; my $mw = MainWindow->new; my $b1 = $mw->BrowseEntry()->grid(); $b1->gridRemove; MainLoop;

This gives a "Can't locate auto/Tk/Entry/gridRemove.al" error. I think I am following the documentation, yet ...

Replies are listed 'Best First'.
Re: Tk::grid and gridRemove()
by gri6507 (Deacon) on Aug 04, 2004 at 21:39 UTC
    After some more playing around, I found that gridForget() method, which has an identical description to gridRemove(), actually works. Now, just to satisfy my own curiosity, what's the difference between the two?
      "remove" seems to be missing in the Perl/Tk port. The following patch against Tk804.027 should fix the problem:
      --- ./Tk/Widget.pm.orig 2004-03-17 17:00:32.000000000 +0100 +++ ./Tk/Widget.pm 2004-08-05 02:15:35.000000000 +0200 @@ -63,7 +63,7 @@ use Tk::Submethods( 'grab' => [qw(current status release -global)], 'focus' => [qw(-force -lastfor)], 'pack' => [qw(configure forget info propagate sl +aves)], - 'grid' => [qw(bbox columnconfigure configure for +get info location propagate rowconfigure size slaves)], + 'grid' => [qw(bbox columnconfigure configure for +get info location propagate remove rowconfigure size slaves)], 'form' => [qw(check configure forget grid info s +laves)], 'event' => [qw(add delete generate info)], 'place' => [qw(configure forget info slaves)], @@ -1151,7 +1151,7 @@ { local $SIG{'__DIE__'} = \&Carp::croak; my $w = shift; - if (@_ && $_[0] =~ /^(?:bbox|columnconfigure|configure|forget|info|l +ocation|propagate|rowconfigure|size|slaves)$/x) + if (@_ && $_[0] =~ /^(?:bbox|columnconfigure|configure|forget|info|l +ocation|propagate|remove|rowconfigure|size|slaves)$/x) { my $opt = shift; Tk::grid($opt,$w,@_);
Re: Tk::grid and gridRemove()
by rinceWind (Monsignor) on Aug 05, 2004 at 12:17 UTC
    Apparently, you can re-grid widgets without actually removing (or forgetting) them. An example of this is in the user contributed widget demo that comes with Tk "N-puzzle implemented via the Grid geometry manager". This is the one with the Camel image, not the numbers puzzle.

    The subroutine move_piece moves a piece by re-gridding it.

    --
    I'm Not Just Another Perl Hacker