On Mon, Apr 8, 2013 at 11:08 PM, Scott Parrill <scott.parr...@wyo.gov> wrote: > All, > > I seem to be missing something simple here but I can't see it. I've > created a megawidget that I want to have a public method on with the > following code > > CustomWidgetTest.pl > ------------------------------ > use Tkx; > use CustomWidget; > > $mw = Tkx::widget->new("."); > $cw = $mw->new_MyCustomWidget; > $cw->m_Fred(); > ------------------------------ > > > CustomWidget.pm > ------------------------------ > package CustomWidget; > > use base qw(Tkx::widget Tkx::MegaConfig); > > __PACKAGE__->_Mega("MyCustomWidget"); > __PACKAGE__->_Config(); > > sub _Populate { > my($class, $widget, $path, %opt) = @_; > > my $self = $class->new($path)->_parent->new_frame(-name => $path, > -class => > "MyCustomWidget", > );
You need a call to: $self->_class($class); about here. This will bless self and make sure that other Tkx::widgets wrapping this $path get blessed as well. Regards, Gisle > $self->new_ttk__entry(-name => 'e'); > > return $self; > } > > sub _mpath { > my $self = shift; > return $self; > } > > sub m_Fred { > print "FRED\n"; > } > > 1; > ------------------------------ > > When I try to use the m_Fred() method, $cw->m_Fred(), I get a 'bad option > "Fred": must be cget or configure' error. What else do I need to do to > register the method? > > Thanks, > Scott > > ---------------------------------------------------------------------- > Scott Parrill > Information Technology Specialist > Enterprise Technology Services / > Wyoming State Geological Survey > State of Wyoming > P.O. Box 1347 > Laramie, WY 82073 > Phone: 307-766-2286 x242 > Fax: 307-766-2605 > E-mail: > scott.parr...@wyo.gov<https://uwmail.uwyo.edu/owa/redir.aspx?C=4dc4ce62e583463fb8ad86380018935b&URL=mailto%3aScott.Parrill%40wyo.gov> > ---------------------------------------------------------------------- > E-Mail to and from me, in connection with the transaction of public > business, is subject to the Wyoming Public Records Act and may be > disclosed to third parties. > ---------------------------------------------------------------------- > > > E-Mail to and from me, in connection with the transaction > of public business, is subject to the Wyoming Public Records > Act and may be disclosed to third parties.