package MyApp;

use Wx qw( :everything );
use base 'Wx::App';

sub OnInit {
   my $self = shift;

   $self->SetTopWindow( MyFrame->new );

   return 1;
}

package MyFrame;

use Wx qw( :everything );
use base 'Wx::Frame';

use Wx::Event qw( EVT_BUTTON );

sub new {
   my $class = shift;

   my $self = $class->SUPER::new( undef, -1, 'wxPerl Test App' );

   $self->{panel} = Wx::Panel->new( $self, -1 );
   $self->{button_1} = Wx::Button->new( $self->{panel}, -1, 'Show Busy Info (no parent)' );
   $self->{button_2} = Wx::Button->new( $self->{panel}, -1, 'Show Busy Info (with parent)' );

   my $sizer = Wx::BoxSizer->new(wxHORIZONTAL);
   $sizer->Add( $self->{button_1}, 0, 0, 0 );
   $sizer->Add( $self->{button_2}, 0, 0, 0 );

   $self->{panel}->SetSizer($sizer);

   EVT_BUTTON( $self, $self->{button_1}, \&evt_button_1 );
   EVT_BUTTON( $self, $self->{button_2}, \&evt_button_2 );

   $self->Show(1);

   return $self;
}

sub evt_button_1 {
   my $self = shift;

   $self->{busy_info} = Wx::BusyInfo->new('This is the message...');
}

sub evt_button_2 {
   my $self = shift;

   $self->{busy_info} = Wx::BusyInfo->new( 'This is the message...', $self );
}

package main;

MyApp->new->MainLoop;