First attempt at creating a mega widget and I can't seem to get the components to take on the default settings. The widget is a frame with two scrolled Listbox and a couple Buttons. I think I have the ConfigSpecs setup correctly, or at least how I've seen it in the books. And the configure method works correctly (only targets the Listboxes with -bg). Can somebody please clue me in to what I'm missing..? Thanks. jpream
package Tk::SelectBoxes; use Tk::widgets qw/Listbox Button/; use base qw(Tk::Frame); Construct Tk::Widget 'SelectBoxes'; use strict; sub ClassInit { my($class, $mw) = @_; $class->SUPER::ClassInit($mw); } sub Populate { my ($self,$args) = @_; $self->SUPER::Populate($args); ########################################### # Build SBox components ########################################### my $left_lb = $self->Scrolled("Listbox", -scrollbars => "osoe", -selectmode => "extended"); my $right_lb = $self->Scrolled("Listbox", -scrollbars => "osoe", -selectmode => "extended"); my $left_btn = $self->Button(-text => '<-', -command => [$self => 'Box2Box', $right_lb, $left_lb]); my $right_btn = $self->Button(-text => '->', -command => [$self => 'Box2Box', $left_lb, $right_lb]); $left_lb->pack(-side => "left", -expand => 1, -fill => "both"); $right_lb->pack(-side => "right", -expand => 1, -fill => "both"); $right_btn->pack(-anchor => "s", -expand => 1); $left_btn->pack(-anchor => "n", -expand => 1); ######################################### $self->ConfigSpecs( '-background' => [[$left_lb, $right_lb], 'background', 'Background' , 'black'], 'DEFAULT' => ['DESCENDANTS', 'SELF']); }

janitored by ybiC: Retitle from "ConfigDefault not working?"


In reply to Tk::widgets ConfigDefault not working? by jpream

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.