Sorry, I forget to mention that I use wxPerl as shown in the code. In my code snippet, I have not included the module that uses the wxHtmlWindow to make the code simpler.
The PAR::PACKER problem seems to do with the "use wxHtmlWindow" regardless of whether I include the actual module or not.
Here is the code for wxHtmlWindow:
use Wx::Html;
package wxHtmlWindow;
use strict;
use base qw(Wx::Panel);
use Wx qw(:sizer);
use Wx::Event qw)EVT_BUTTON);
sub new {
my $class = shift;
my $this = $class->SUPER::new( $_[0], -1 );
my $html = $this->{HTML} = wxHtmlWindow::Derived->new( $this, -1 );
my $top_sizer = Wx::BoxSizer->new( wxVERTICAL );
my $but_sizer = Wx::BoxSizer->new( wxHORIZONTAL );
my $print = Wx::Button->new( $this, -1, 'Print' );
my $forward = Wx::Button->new( $this, -1, 'Forward' );
my $back = Wx::Button->new( $this, -1, 'Back' );
my $preview = Wx::Button->new( $this, -1, 'View' );
#my $pages = Wx::Button->new( $this, -1, 'Page Setup' );
$but_sizer->Add( $back );
$but_sizer->Add( $forward );
$but_sizer->Add( $preview );
$but_sizer->Add( $print );
#$but_sizer->Add( $pages );
$top_sizer->Add( $html, 1, wxGROW|wxALL, 5 );
$top_sizer->Add( $but_sizer, 0, wxALL, 5 );
$this->SetSizer( $top_sizer );
$this->SetAutoLayout( 1 );
EVT_BUTTON( $this, $print, \&OnPrint );
EVT_BUTTON( $this, $preview, \&OnPreview );
EVT_BUTTON( $this, $forward, \&OnForward );
EVT_BUTTON( $this, $back, \&OnBack );
#EVT_BUTTON( $this, $pages, \&OnPageSetup );
$this->{PRINTER} = Wx::HtmlEasyPrinting->new( 'ZTC GUI' );
return $this;
}
sub html { $_[0]->{HTML} }
sub printer { $_[0]->{PRINTER} }
sub OnPrint {
my( $this, $event ) = @_;
$this->printer->PrintFile( $this->html->GetOpenedPage );
}
#sub OnPageSetup {
# my $this = shift;
#
# $this->printer->PageSetup();
#}
sub OnPrinterSetup {
my $this = shift;
$this->printer->PrinterSetup();
}
sub OnPreview {
my( $this, $event ) = @_;
$this->printer->PreviewFile( $this->html->GetOpenedPage );
}
sub OnForward {
my( $this, $event ) = @_;
$this->html->HistoryForward();
}
sub OnBack {
my( $this, $event ) = @_;
$this->html->HistoryBack();
}
package wxHtmlWindow::Derived;
use strict;
use base qw(Wx::HtmlWindow);
sub new {
my $class = shift;
my $this = $class->SUPER::new( @_ );
$this->LoadPage( 'files/index.html' ); # in /files folder
#print $this->ToText, "\n";
return $this;
}
sub OnLinkClicked {
my( $this, $link ) = @_;
Wx::LogMessage( 'Link clicked: href="%s"', $link->GetHref() );
$this->SUPER::OnLinkClicked( $link );
}
1;
|