I'm trying to add an event-handler to a subclass of Wx::StaticBoxSizer, but I'm 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 that mean that Wx::StaticBoxSizer can't handle events? If so, is there another way to structure my object so that it will automatically resize and handle its own events?
My subclass code follows. I can add the frame and app classes as well if necessary.
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!'); }
Thanks