Creating a derived widget that is a -container

"H. Wade Minter" <[email protected]>
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I posted this to the newsgroup a couple of weeks ago and got no 
response, so I'm posting to the mailing list in hopes of getting a look 
from people who read this and not the group.

I'm creating a widget that is based on Tk::Frame. I want this widget to 
be a container so that another toplevel can -use it for embedding.

The trick is that I want the -container flag to get set on this widget 
DURING its construction, not afterward. I'm pretty confused as to how 
to do this.  I'm using Chapter 14 in Mastering Perl/Tk as a guide for 
creating the Tk::Frame-based widget.

Should this be done during the ClassInit sub, or the Populate sub?

I'm trying it with Populate, but can't get it to work. I've got:

sub Populate {
   my ($self, $args) = @_;
   $self->SUPER::Populate($args);
   $self->configure(-container=>1);
...

}

However, during the Populate, if I later try to -use $self's widget id, 
I get:

Tk::Error: Can't set -container to `1' for Tk::MyWidget=HASH(0x8b3f00): 
can't modify -container option after widget is created at 
/Library/Perl/5.8.1/darwin-thread-multi-2level/Tk/Configure.pm line 46.

If I try to do something like:

sub Populate {
   my ($self, $args) = @_;
   $args->{-configure} = 1;
   $self->SUPER::Populate($args);
   $self->configure(-container=>1);
...

}

Then it just seems to silently fail like:

window ".foo" doesn't have -container option set at 
/Library/Perl/5.8.1/darwin-thread-multi-2level/Tk/Widget.pm line 190.

Any suggestions as to what magic I need to do to enable this will be 
welcomed.

Thanks,
Wade
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFBxN8zo4DwsyRGDscRAlytAKDuVQZ7z9VlziCyjxppG76k7FZbzwCfSDeo
g0/MWWn3HZ35Yt3gNwpcfQc=
=r6py
-----END PGP SIGNATURE-----


-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.