in reply to Re: Can a sublcass of Wx::StaticBoxSizer handle events in wxPerl?
in thread Can a sublcass of Wx::StaticBoxSizer handle events in wxPerl?
Thanks for the guidance. Unfortunately, I tried your suggestion and now my control isn't even displaying correctly. Any ideas?
package my_control; use base 'Wx::Control'; use Wx qw(:sizer); use Wx::Event qw(EVT_BUTTON); sub new { my $ref = shift; my $parent = shift; my $self = $ref->SUPER::new($parent, -1); $self->{sizer} = Wx::StaticBoxSizer->new( Wx::StaticBox->new($parent, -1, 'Box label'), wxHORIZONTAL ); $self->{button} = Wx::Button->new($parent, -1, 'Button'); $self->{sizer}->Add($self->{button}); EVT_BUTTON($self, $self->{button}, \&click); $self->SetSizer($self->{sizer}); $self->{sizer}->SetSizeHints($self); $self->{sizer}->FitInside($self); return $self; } sub click { Wx::MessageBox('Click!'); }
(If you can't tell, I'm new to both wxPerl and Perl objects.)
Thanks again.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Can a sublcass of Wx::StaticBoxSizer handle events in wxPerl?
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 | |
by Anonymous Monk on Jun 23, 2010 at 18:58 UTC | |
by ikegami (Patriarch) on Jun 23, 2010 at 19:10 UTC |