#!/usr/bin/perl -w
use strict;
use warnings;
use Wx qw/:everything/;
package MyApp;
use base 'Wx::App';
use Wx::Html;
sub OnInit {
my $frame = Wx::Frame->new( undef,-1,'TextCtrl in HtmlWindow');
my $html=Wx::HtmlWindow->new($frame,-1);
$html->GetParser->AddTagHandler(MyHtmlTagHandler->new);
$html->SetPage('
');
$frame->Show( 1 );
}
package MyHtmlTagHandler;
use base 'Wx::PlHtmlTagHandler';
sub new {
my $class = shift;
my $this = $class->SUPER::new;
return $this;
}
sub GetSupportedTags {
return 'WXPERLEDIT';
}
sub HandleTag {
my( $this, $htmltag ) = @_;
my $parser = $this->GetParser;
my $htmlwin = $parser->GetWindow;
my $entry=Wx::TextCtrl->new($htmlwin,-1,'text');
my $cell=Wx::HtmlWidgetCell->new($entry);
my $cnt = $parser->GetContainer;
$cnt->InsertCell( $cell ) if $cell;
return 1;
}
package main;
MyApp->new->MainLoop;