From: Graciliano M. P. \(V. Sites\) <gm...@vi...> - 2002-04-22 20:22:59
|
Here are an example of text style in TextCtrl. Only for WxPerl 0.11 with = wxwindows2.3.3 (link of 0.11 beta: http://wwwstud.dsi.unive.it/~mbarbon/wx/) ------------------------------------------- use Wx qw(wxTE_MULTILINE wxTE_RICH2); use Wx qw(wxNORMAL wxRED wxBLUE wxLIGHT_GREY); my $text =3D Wx::TextCtrl->new( $HWX_app_obj{window} , -1, "", [0,0], = [500,400], wxTE_MULTILINE|wxTE_RICH2 ); ## The Style Flasg of TextCtrl need the option wxTE_RICH2 (to receive = text & background colors) or ## wxTE_RICH (to receive only text colors). =20 my $font =3D Wx::Font->new( 10 , wxDEFAULT , wxNORMAL , wxNORMAL , 0 , = 'Courier New' ); $text->SetFont( $font ) ; ## Set the defalt font. We ill use this font in the styles too. my $style_1 =3D Wx::TextAttr::new( undef , wxBLUE , wxNullColour , = $font ) ; my $style_2 =3D Wx::TextAttr::new( undef , wxRED , wxLIGHT_GREY , = $font ) ; $text->SetDefaultStyle( $style_1 ) ; ## Any text writed ill use this style (blue). $text->WriteText("Hello!!!\nText Style are working?!\n"); =20 $text->SetStyle( 0,7, $style_2 ) ; ## Set the style 2 (red) form char 0 to 7. =20 $text->Refresh ; ## refresh to update some idle drawing. ------------------------------------------- |