Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
#!/usr/bin/perl -w package WxBrowser::GUI; use strict; use Wx qw/:everything/; use Wx::Html; use base qw(Wx::Frame); use Wx::Event qw( EVT_BUTTON EVT_MENU); use vars qw/ %ID_ $I/; %ID_ = map { $_ => 1000 + int(rand 30) + $I++ } qw/ GOTEXT GOBUTTON HTML ABOUT QUIT GOTEXT/; sub new { my( $class ) = shift; my( $this ) = $class->SUPER::new( undef, -1, "WxBrowser - a wxPerl HTML Browser ", [0,0], [300,300], wxDEFAULT_FRAME_STYLE| wxCLIP_CHILDREN, ); $this->CreateStatusBar( 2 ); $this->SetStatusText( "Welcome to WxBrowser!", 1); $this->GOOEY(); $this->SetMenuBar( MENUU($this) ); EVT_BUTTON( $this, $ID_{GOBUTTON}, \&GONOW ); EVT_MENU( $this, $ID_{ABOUT}, \&OnAbout ); EVT_MENU( $this, $ID_{QUIT}, \&OnQuit ); return $this; } sub OnAbout { my( $this, $event ) = @_; Wx::MessageBox( "Welcome to WxBrowser 1.0 WxBrowser is a crude browser created as a demo of wxPerl Has basic support for html (probably html 1.0 or 2.0) That means, no cookies, no images, no forms, bad tables ;) (C)opyright CrazyInsomniac of PerlMonks.org. This program is released under the same terms as perl itself (if you don't know what that means, visit perl.com ) ", "About WxBrowser", wxOK|wxICON_INFORMATION, $this ); } sub OnQuit { my( $this, $event ) = @_; $this->Close(1); } sub MENUU { my( $bar ) = Wx::MenuBar->new(); my( $filemenu ) = Wx::Menu->new(); $filemenu->Append( $ID_{ABOUT}, "About", "Find Out Who Created WxB +rowser" ); $filemenu->Append( $ID_{QUIT}, "Quit", "Exit this application" ); $bar->Append( $filemenu, "File" ); return $bar; } sub GONOW { my ($this, $event) = @_; my $html = $this->FindWindow($ID_{HTML}); my $text = $this->FindWindow($ID_{GOTEXT}); $html->LoadPage($text->GetValue()); return(); } sub GOOEY{ my $parent = shift; my( $sizer1 ) = Wx::BoxSizer->new( wxVERTICAL ); my( $sizer2 ) = Wx::BoxSizer->new( wxVERTICAL ); my( $htmlsizer ) = Wx::BoxSizer->new( wxVERTICAL ); ### my( $html ) = Wx::HtmlWindow->new( ### $parent, $ID_{HTML}, wxDefaultPosition, wxDefaultSize, ); $html->SetRelatedFrame($parent, "WxBrowser: %s"); $html->SetRelatedStatusBar(0); $html->SetPage('<H1><a href="http://perlmonk.org/~grinder"><font c +olor="#be2076">W</font><font color="#b15088">a</font><font color="#a2 +8999">v</font><font color="#93bea9">e</font> <font color="#83e3b9">i< +/font><font color="#73efc7">t</font> <font color="#63e0d3">h</font><f +ont color="#54b9dd">i</font><font color="#4583e5">g</font><font color +="#374aeb">h</font><font color="#2a1cef">,</font><P><font color="#1e0 +2ef">l</font><font color="#1404ee">e</font><font color="#0c08e9">t</f +ont> <font color="#060de3">t</font><font color="#0214da">h</font><fon +t color="#001bcf">a</font><font color="#0024c2">t</font> <font color= +"#092eb3">f</font><font color="#1e38a4">r</font><font color="#3d4393" +>e</font><font color="#624f82">a</font><font color="#8a5b70">k</font> +<P><font color="#af685f">f</font><font color="#cf754e">l</font><font +color="#e5813e">a</font><font color="#ef8e2f">g</font> <font color="# +ec9a22">f</font><font color="#dda617">l</font><font color="#c2b20d">y +</font>!</a></H1>'); $htmlsizer->AddWindow( $html, 1, wxALIGN_CENTRE|wxGROW, 0 );### $sizer2->Add($htmlsizer, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 0 );## +# my( $sizer3 ) = Wx::BoxSizer->new( wxHORIZONTAL ); my( $text ) = Wx::TextCtrl->new( $parent, $ID_{GOTEXT}, "http://perlmonk.org/#jc+wrocks!", wxDefaultPosition, # [460,-1], wxDefaultSize, wxGROW # I don't even know if this works here ); $sizer3->AddWindow( $text, 1, wxGROW|wxALIGN_CENTER_HORIZONTAL, 0 +); my( $item9 ) = Wx::Button->new( $parent, $ID_{GOBUTTON}, "GO", wxDefaultPosition, [50,20], 0 ); $sizer3->AddWindow( $item9, 0, wxALIGN_RIGHT|wxALL, 0 ); ## switch these two lines, the wxBOTTOM or wxTOP don't matter $sizer1->Add( $sizer3, 0, wxGROW|wxTOP, 0 ); $sizer1->Add( $sizer2, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 0 ); $parent->SetAutoLayout( 1 ); $parent->SetSizer( $sizer1 ); } package WxBrowser; use strict; use base qw(Wx::App); use Wx qw(:everything); sub OnInit { my( $this ) = @_; my( $frame ) = new WxBrowser::GUI(); $frame->Show(1); 1; } package main; my $Browser = new WxBrowser(); $Browser->MainLoop(); __END__ =pod Run the program! =cut

In reply to WxBrowser - a wxPerl HTML Browser by crazyinsomniac

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (8)
    As of 2014-12-27 01:39 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (176 votes), past polls