Hello,
I am working on a simple text-editor that would just highlight certain words for me like programming language keyworks, lets say PHP. Does wxTextCtrl support highlighting text in colors, and how?
Thanks,
Rakan
wxTextCtrl text-highlight Topic is solved
Hi,
While those are probably better choices in your case, just for the record you can do this in wxTextCtrl too, using http://docs.wxwidgets.org/stable/wx_wxtextattr.html.
e.g.
You can change colours too.
Regards,
David
While those are probably better choices in your case, just for the record you can do this in wxTextCtrl too, using http://docs.wxwidgets.org/stable/wx_wxtextattr.html.
e.g.
Code: Select all
wxTextAttr style; wxFont font;
style = text->GetDefaultStyle(); // Save original style
font = style.GetFont(); // Get default font, & enBolden it
font.SetWeight(wxBOLD );
...
if ( foo )
{ text->SetDefaultStyle( wxTextAttr(wxNullColour, wxNullColour, font) ); // Turn on Bold
text->AppendText( bar ); // Add wxString bar to textctrl with Bold font
text->SetDefaultStyle( style ); // Reset to original style, for future Appends
}
...
Regards,
David