School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,419 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,500 people online right now. Registration is fast and FREE... Join Now!




wxPerl Frame Padding Issue

 

wxPerl Frame Padding Issue, wxPerl widget, when rendered in a panel, starts at [1,1].

Tracekill

24 Jun, 2009 - 12:37 PM
Post #1

New D.I.C Head
*

Joined: 17 Jan, 2009
Posts: 9

Hey there. I'm having a problem with wxPerl on a Windows platform (though this isn't immediately relevant). Basically, I have a Wx::Panel within a Wx::Frame and it's rendering all the contained widgets just fine but one of the widgets I've used for this project is a Wx::Perl::DirTree (a directory tree module). When implemented, it produces this window:

IPB Image

As you can see, the DirTree is crammed up into the upper-left corner when I want it to be spaced from the edges of the frame by about 50px. Can anybody tell me how I might accomplish such a thing?

Here is the code:

CODE
use warnings;
use Spreadsheet::WriteExcel;
use HTML::TagReader;
use Wx;

# Main application frame subclass.
package XMLLoaderFrame;
use base 'Wx::Frame';
use Wx::Event qw(EVT_BUTTON);
use Wx::Perl::DirTree;
use Wx qw(wxVERTICAL wxTOP);

sub new{
    my $ref = shift;
    my $self = $ref->SUPER::new(undef, -1, 'XML to XLS Parser', [-1, -1], [600, 500]);
    my $panel = Wx::Panel->new($self, -1);
    my $run = Wx::Button->new($panel, -1, 'Parse XML', [470, 420], [-1, -1]);
    my $dirtree = Wx::Perl::DirTree->new($panel, [200, 300]);
    
    my $mainsizer = Wx::BoxSizer->new(wxVERTICAL);
    $mainsizer->Add($dirtree->GetTree(), 0, wxTOP, 0);
    
    # How to handle button pressed event
    EVT_BUTTON($self, $run, \&OnClick);
    
    return $self;
}

sub OnClick{
    my($self, $event, $btn) = @_;
    
}

# Core application class
package XMLLoader;
use base 'Wx::App';

sub OnInit{
    # When initialized, construct new frame and display it.
    my $frame = XMLLoaderFrame->new;
    $frame->Show(1);
}

# Main application class. Contains event listening and drawing loop.
package main;

my $instance = XMLLoader->new;
$instance->MainLoop;


This post has been edited by Tracekill: 24 Jun, 2009 - 12:40 PM

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 11:52PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month