Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to create a subclass of Wx::StaticBoxSizer as a reusable object that will handle its own events, as shown:
package my_sizer; use base 'Wx::StaticBoxSizer'; use Wx qw(:sizer); use Wx::Event qw(EVT_BUTTON); sub new { my $ref = shift; my $parent = shift; my $self = $ref->SUPER::new( Wx::StaticBox->new($parent, -1, 'Box label'), wxHORIZONTAL ); my $button = Wx::Button->new($parent, -1, 'Button'); $self->Add($button); EVT_BUTTON($self, $button, \&click); $self->SetSizeHints($parent); return $self; } sub click { Wx::MessageBox('Click!'); }
But I am getting the following error:
Can't locate object method "Connect" via package "Wx::StaticBoxSizer" at C:/strawberry/perl/site/lib/Wx/Event.pm line 38.
Does this mean that Wx::StaticBoxSizer and subclasses can't handle events? If so, is there another way to restructure my object so that it can handle its own events?
Thank you, monks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can a sublcass of Wx::StaticBoxSizer handle events in wxPerl?
by ikegami (Patriarch) on Jun 23, 2010 at 17:12 UTC | |
by Anonymous Monk on Jun 23, 2010 at 17:42 UTC | |
by ikegami (Patriarch) on Jun 23, 2010 at 18:01 UTC | |
by Anonymous Monk on Jun 23, 2010 at 18:09 UTC | |
by ikegami (Patriarch) on Jun 23, 2010 at 18:27 UTC | |
| |
|
Re: Can a sublcass of Wx::StaticBoxSizer handle events in wxPerl?
by TGI (Parson) on Jun 23, 2010 at 21:28 UTC |