Hi All,

I have wx application that relies on a set of templates to generate letters.
I am providing a basic letter editor using wxRichTextCtrl and therefore I'd
like to load the letters before editing.

This is the code I'm using, but I get a perl crash with no error message
when I run it (the equivalent 'SaveFile' function works perfectly, thanks to
Jiri).

Does anyone have any ideas?


        open(my $fh, "<output.xml") or die "cant open output file: $!";
        my $html_handler = Wx::RichTextXMLHandler->new;
        my $buffer;
        $html_handler->LoadFile($buffer, $fh );
        $self->{rich_text_ctrl_1}->SetBuffer($buffer);


Regards

Steve




-----Original Message-----
From: Jiri Pavlovsky [mailto:j...@getnet.cz] 
Sent: 03 January 2010 20:07
To: wxperl-users@perl.org
Subject: Re: wxRichTextCtrl

On 3.1.2010 22:57, Steve Cookson wrote:
>> I don't know about th XML format, but here is how I get HTML from the
>> widget:
>
>
>>   my $buffer = $richtext->GetBuffer;
>>   open(my $fh, '>', \my $html) || die 'cannot open';
>>    my $html_handler = Wx::RichTextHTMLHandler->new;
>>   $html_handler->SaveFile($buffer, $fh);
>
> Hi Jiri
>
> That looks great.  I'd rather use HTML anyway as it's more "industry
> standard".
>
> Can you do a "LoadFile" too?

Probably, but I did not get to it yet.

  There seems to be a "Wx::RichTextHTMLHandler"
> with DoSaveFile and DoLoadFile.

Just note that I use SaveFile on Wx::RichTextHTMLHandler. DoSaveFile 
doesn't seem to be available from wxperl. So I tried 'SaveFile' and it 
worked.

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.725 / Virus Database: 270.14.124/2598 - Release Date: 01/03/10
07:41:00

Reply via email to