Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

RFC for Tutorials: Using BoxSizer Layout Manager in wxPerl

by waxhead (Acolyte)
on Apr 19, 2009 at 06:30 UTC ( #758548=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package SizerExampleFrame;
    
    ...
                        [600, 400],
                    );
    
  2. or download this
    my $vbox = Wx::BoxSizer->new( wxVERTICAL );
    
  3. or download this
        my $pnl1 = Wx::Panel->new($self, -1);
        my $pnl2 = Wx::Panel->new($self, -1);
        my $pnl3 = Wx::Panel->new($self, -1);
        my $pnl4 = Wx::Panel->new($self, -1);
    
  4. or download this
    my $lbl1 = Wx::StaticText->new(    $pnl1,        # parent
                    -1,        # id,
                    "Testing: 1",    # label
                    [5,10],        # position
                );
    
  5. or download this
    my $lbl2 = Wx::StaticText->new(    $pnl2,        # parent
                    -1,        # id,
    ...
                    [5,10],        # position
                );
    
  6. or download this
        # now we want to create a vbox for the 4th panel
        # in this we will put button and other panels
        
        my $pnl4Vbox = Wx::BoxSizer->new( wxVERTICAL );
    
  7. or download this
    my $btnBox = Wx::BoxSizer->new( wxHORIZONTAL );
    my $pnlBtns = Wx::Panel->new( $pnl4,         #parent
    ...
                    0 # border style
                    );
    
  8. or download this
    my $btnButton1 = Wx::Button->new( $pnlBtns, -1, 'Button 1');
    EVT_BUTTON( $pnlBtns, $btnButton1, \&btnButton1Clicked );
    ...
    my $btnButton2 = Wx::Button->new( $pnlBtns, -1, 'Button 2');
    EVT_BUTTON( $pnlBtns, $btnButton2, \&btnButton2Clicked );
    
  9. or download this
        $btnBox->Add( $btnButton1, 1, wxALIGN_BOTTOM, 0 );
        $btnBox->Add( $btnButton2, 1, wxALIGN_BOTTOM, 0 );
    
  10. or download this
        $pnlBtns->SetSizer($btnBox);
    
  11. or download this
        $pnl4->SetSizer($pnl4Vbox);
    
  12. or download this
        $vbox->Add( $pnl1, 1, wxEXPAND | wxALL, 3);
        $vbox->Add( $pnl2, 1, wxEXPAND | wxALL, 3);
        $vbox->Add( $pnl3, 1, wxEXPAND | wxALL, 3);
        $vbox->Add( $pnl4, 1, wxEXPAND | wxALL, 3);
    
  13. or download this
        $self->SetSizer( $vbox );
    
    ...
        
    }
    
  14. or download this
    sub btnButton1Clicked {
            my( $self, $event ) = @_;
    ...
        my( $self, $event ) = @_;
        print "Button 2\n";
    }
    
  15. or download this
    
    
    ...
    
    
    1;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://758548]
Approved by ikegami
Front-paged by Tanktalus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (15)
As of 2015-07-30 13:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls