enroute has asked for the wisdom of the Perl Monks concerning the following question:
#!/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('<html><body><wxperledit /></body></html>'); $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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: wxperl's TextCtrl in HtmlWindow won't do Copy or Cut
by Anonymous Monk on Aug 24, 2010 at 08:20 UTC |