Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Wx::Panel not rendering

by tunaboy (Curate)
on Feb 10, 2005 at 00:06 UTC ( [id://429552]=note: print w/replies, xml ) Need Help??


in reply to Wx::Panel not rendering

OS: WinXP
Perl: ActiveState 5.8.3 build 809
wxPerl: 0.19

With your original code if I minimise then maximise the window the panel appears. So my guess is the window needs to be redrawn for the panel to appear. I tried doing a $self->Refresh inside the menu callback but that did not work for me.

I made the following changes to have it appear automatically:

... # when the "New" menu item is activated, a panel should render EVT_MENU($self, $ID_MAKE_PANEL, \&_make_panel ); EVT_MENU($self, $ID_EXIT, sub { $self->Close(1) }); $self; } sub _make_panel { my ( $self ) = @_; return if exists $self->{'panel'}; use Wx qw( wxVERTICAL wxGROW ); my $panel = Wx::Panel->new( $self, # parent -1, # id [ -1, -1 ], # position [ 200, 200 ] ); # size my $sizer = Wx::BoxSizer->new(wxVERTICAL); $sizer->Add( $panel, 1, wxGROW ); $self->SetSizer($sizer); $sizer->SetSizeHints($self); $self->{'panel'} = $panel; } ...

Using the sizer to resize the window after the panel is created makes it appear for me. Of course the frame changes size as well which may not be what you are after.

I am not sure if this is what you are after or if it helps at all.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://429552]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-26 03:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found