in reply to Re: Wxperl child window destroy
in thread Wxperl child window destroy
#!perl -w use Wx; ####################################### # # package MyApp; # # ####################################### use strict; use vars qw(@ISA); @ISA = qw(Wx::App); # the OnInit method is called sub OnInit { my($this) = @_; my($frame) = MyFrame->new( undef, -1, "Test window", [600, 400], [ +400, 600] ); $frame->Show(1); $this->SetTopWindow($frame); # if OnInit doesn't return true, the application exits immediately +. return 1; } ####################################### # # package MyFrame; # # ####################################### # # This package overrides Wx::Frame, and allows us to put controls # in the frame. # use strict; use vars qw(@ISA); @ISA = qw(Wx::Frame); sub new { my( $class ) = shift; my( $this ) = $class->SUPER::new( @_ ); # starter variables for 'x' and 'y' position my $xstart = 5; my $ystart = 5; my %panel; # Create panel: 'First' $panel{'first'} = Wx::Panel->new( $this, -1, ); # create panel 1 static text Wx::StaticText->new( $panel{'first'}, -1, 'First panel', [$xstart, $ystart] ); $panel{'first'}->Hide(); + # Create panel: 'Second' $panel{'second'} = Wx::Panel->new( $this, -1, ); # create panel 2 static text Wx::StaticText->new( $panel{'second'}, -1, 'Second panel', [$xstart, $ystart] ); $panel{'second'}->Show(); return $this; } package main; my($app) = MyApp->new(); $app->MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Wxperl child window destroy ( hide/show wxpanel in same wxframe )
by Anonymous Monk on Jun 20, 2012 at 10:26 UTC | |
by Anonymous Monk on Jun 20, 2012 at 11:44 UTC | |
by Anonymous Monk on Jun 20, 2012 at 11:58 UTC |