Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I first thought that this question would target people who specifically know how Glade works when it generates Perl code, because I suppose this is a bug with Glade. Here goes the entire code for app.pl:

use Wx 0.15 qw[:allclasses]; use strict; 1; package main; use MyFrame8; unless(caller){ local *Wx::App::OnInit = sub{1}; my $app = Wx::App->new(); Wx::InitAllImageHandlers(); my $frame_9 = MyFrame8->new(); $app->SetTopWindow($frame_9); $frame_9->Show(1); $app->MainLoop(); }

MyFrame8.pm is also generated by Glade and it has a bit more code that makes the frame. Still, there's no OnInit in there. The only OnInit is the one above, also generated by Glade. Here's MyFrame8.pm then:

use Wx 0.15 qw[:allclasses]; use strict; package MyFrame8; use Wx qw[:everything]; use base qw(Wx::Frame); use strict; # begin wxGlade: ::dependencies # end wxGlade sub new { my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_ +; $parent = undef unless defined $parent; $id = -1 unless defined $id; $title = "" unless defined $title; $pos = wxDefaultPosition unless defined $pos; $size = wxDefaultSize unless defined $size; $name = "" unless defined $name; # begin wxGlade: MyFrame8::new $style = wxDEFAULT_FRAME_STYLE unless defined $style; $self = $self->SUPER::new( $parent, $id, $title, $pos, $size, $sty +le, $name ); $self->{panel_1} = Wx::Panel->new($self, -1, wxDefaultPosition, wx +DefaultSize, ); $self->{label_1} = Wx::StaticText->new($self->{panel_1}, -1, "labe +l_1", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); $self->{Test} = Wx::Button->new($self->{panel_1}, -1, "Test"); $self->__set_properties(); $self->__do_layout(); # end wxGlade return $self; } sub __set_properties { my $self = shift; # begin wxGlade: MyFrame8::__set_properties $self->SetTitle("frame_9"); $self->SetSize(Wx::Size->new(400, 300)); # end wxGlade } sub __do_layout { my $self = shift; # begin wxGlade: MyFrame8::__do_layout $self->{sizer_9} = Wx::BoxSizer->new(wxVERTICAL); $self->{sizer_10} = Wx::BoxSizer->new(wxVERTICAL); $self->{sizer_11} = Wx::BoxSizer->new(wxVERTICAL); $self->{sizer_10}->Add($self->{label_1}, 1, wxALIGN_CENTER_HORIZON +TAL, 0); $self->{sizer_11}->Add(0, 78, 0, wxADJUST_MINSIZE, 0); $self->{sizer_11}->Add($self->{Test}, 0, wxALIGN_CENTER_HORIZONTAL +, 0); $self->{sizer_10}->Add($self->{sizer_11}, 1, wxALL|wxEXPAND, 0); $self->{panel_1}->SetAutoLayout(1); $self->{panel_1}->SetSizer($self->{sizer_10}); $self->{sizer_10}->Fit($self->{panel_1}); $self->{sizer_10}->SetSizeHints($self->{panel_1}); $self->{sizer_9}->Add($self->{panel_1}, 1, wxEXPAND, 0); $self->SetAutoLayout(1); $self->SetSizer($self->{sizer_9}); $self->Layout(); # end wxGlade } # end of class MyFrame8 1;


In reply to Re^2: WxPerl and Glade: Wx::App::OnInit redefined by carcassonne
in thread WxPerl and Glade: Wx::App::OnInit redefined by carcassonne

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 meditating upon the Monastery: (6)
As of 2024-04-19 10:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found