in reply to Re: Specifying the -class of Tk subwidgets
in thread Specifying the -class of Tk subwidgets
And here's an excerpt from the .Xdefaults:use Tk; use lib '/genesis/oscripts/misc_scr/lib'; use OwegoCAM::GUI::GUIBuilder::LabelOption; my($mw) = MainWindow->new; my($fileloc) = "/genesis/oscripts/misc_scr/lib/OwegoCAM/GUI/GUIBuilder +/.Xdefaults.ocd"; $mw->optionReadfile($fileloc) if (-e $fileloc); my(%foo) = ('bar' => [qw/yes no maybe/]); my($bah) = $mw->LabelOption(-class => 'Lab2', -options => $foo{'bar'}, -label => 'Is it safe?', -labelPack => [-side => 'left'] )->pack(); MainLoop;
The only thing that actually gets a color set is the option menu background when the mouse is over it, and the optionmenu's width. Thanks, -Peter Oh, sorry. Rereading the original post, I've since changed the original module that I was using. The Tk widget code now looks like this (mostly lifted from Mastering Perl/Tk):*Lab2*optionmenu*activeForeground:#000000 *Lab2*optionmenu*activeBackground:tan3 *Lab2*optionmenu*background:tan3 *Lab2*optionmenu*font:-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*- +* *Lab2*optionmenu*foreground:#000000 *Lab2*optionmenu*relief:raised *Lab2*optionmenu*cursor:right_ptr *Lab2*optionmenu*width:15 *Lab2*optionmenu*anchor:w *Lab2*label*background:wheat1 *Lab2*label*font:-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-* *Lab2*label*foreground:black *Lab2*label*relief:flat *Lab2*label*width:15 *Lab2*label*anchor:w
package LabelOption; use Tk::widgets qw /Optionmenu/; use base qw/Tk::Frame/; use strict; Construct Tk::Widget 'LabelOption'; sub ClassInit { my($class, $mw) = @_; $class->SUPER::ClassInit($mw); } sub Populate { my($self, $args) = @_; $self->SUPER::Populate($args); my($o) = $self->Optionmenu->pack(); $self->Advertise('optionmenu' => $o); $self->ConfigSpecs('DEFAULT' => [$o]); $self->Delegates('DEFAULT' => $o); } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Specifying the -class of Tk subwidgets
by lamprecht (Friar) on Jul 10, 2009 at 14:05 UTC | |
by monksp (Acolyte) on Jul 10, 2009 at 16:14 UTC |