Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Re: Wx::Panel not rendering by tunaboy
in thread Wx::Panel not rendering by japhy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-19 10:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found