use Wx qw(:everything); package MyApp; use strict; use vars qw(@ISA); @ISA = qw(Wx::App); sub OnInit { my($this) = @_; my($frame) = MyFrame->new( undef, -1, "Testing Popup", [-1,-1], [350, 150]); $frame->CenterOnScreen; $frame->Show(1); $this->SetTopWindow($frame); return 1; } package MyFrame; use strict; use vars qw(@ISA); @ISA = qw(Wx::Frame); use Wx qw(:everything); use Wx::Event qw(EVT_SIZE EVT_BUTTON EVT_UPDATE_UI EVT_TOOL_ENTER ); sub new { my( $class ) = shift; my( $this ) = $class->SUPER::new( @_ ); $this->{main_window} = $this; my $popup = Wx::PopupWindow->new( $this, wxSIMPLE_BORDER | wxWANTS_CHARS ); $popup->Move( 200, 200 ); $popup->SetSize( 300, 100 ); my( $text_entry ) = Wx::TextCtrl->new( $popup, -1, 'Test', [10, 20], wxDefaultSize); my( $text_button ) = Wx::Button->new( $popup, -1, 'Get Text', [10, 50] ); my( $show_button ) = Wx::Button->new( $this, -1, 'Show', [130, 20] ); my( $hide_button ) = Wx::Button->new( $this, -1, 'Hide', [130, 60] ); EVT_BUTTON( $this, $show_button, sub {$popup->Show; } ); EVT_BUTTON( $this, $hide_button, sub {$popup->Hide;} ); EVT_BUTTON( $this, $text_button, sub {print "Value: " . $text_entry->GetValue . "\n";} ); return $this; } package main; my($app) = MyApp->new(); $app->MainLoop();