> hello
>
> i tried to change the printing demo to take the data from a textctrl.
> but i was unable to do it because i don't understand what the demo is exactly
> doing...
> can someone give a small example how to print the text in a textctrl?
This example uses Wx::HtmlEasyPrinting to do the job. It is IMHO the
easiest way to do what you want. You can see how the wxHtmlWindow demo
uses it. An extract is below.
# construct a Wx::HtmlEasyPrinting and keep it around
# you will probably store that in $this->{PRINTER}, but
# $printer is shorter...
$printer = Wx::HtmlEasyPrinting->new( 'wxPerl demo' );
# Page Setup (needs to be done only once)
$printer->PageSetup;
# likewise for Printer Setup
$printer->PrinterSetup;
# get the text
my $text = $textctrl->GetValue;
my $html = "<html><head></head><body>$text</body></html>";
# preview it
$printer->PreviewText;
# or print it
$printer->PrintText;
# you should be able to save/restore Page/Printer setup
# using
my $data1 = $printer->GetPageSetupData;
my $data2 = $printer->GetPrintData;
# and calling the Get/Set methods on $data1 and $data2
# but I haven't tried if this works
HTH
Mattia
|