| H. Wade Minter 2004-12-07, 4:10 am |
| 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. I'm pretty as to how to do this.
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
|