in reply to Tk widget derivation problems

I re-arranged the order that the base classes are called and it works... try this:
package Tk::Foon; use base qw(Tk::Label Tk::Derived); #<= changed order Construct Tk::Widget 'Foon'; sub ClassInit { my($class, $mw) = @_; $class->SUPER::ClassInit($mw); } sub Populate { my($self, $args) = @_; $self->SUPER::Populate($args); $self->ConfigSpecs('DEFAULT' => [ 'SELF' ]); }
Cheers,
JamesNC

Replies are listed 'Best First'.
Re: Re: Tk widget derivation problems
by anjiro (Beadle) on Aug 03, 2003 at 00:20 UTC
    Very strange... I worry about doing that, however, because the man page for Tk::derived says:

    Tk::Derived should precede any Tk widgets in the class's @ISA.

    Update: And the reason for this appears to be so that you can pass your own arguments. If I switch the order so List appears first and Derived second, then when I create my new object with some option that I want to handle, like my $x = $mw->Foon(-taco => 'bell', -foreground => 'brown');, all the options go to the Label first, which doesn't understand -taco.

    Daniel Ashbrook