wxRichTextCtrl
Official Classes | Archive • Containers • Controls • Data Structures • Database • Date & Time • Debug • Device Contexts • Dialogs • Document & Views • Drag & Drop • Events • Filesystem • Frames • Graphics • Grid Cell • Help • HTML • Logging • Miscellaneous • Networking • Printing • Sizers • Streams • Threading • Windows |
wxRichTextCtrl provides a generic, ground-up implementation of a text control capable of showing multiple styles and images.
wxRichTextCtrl sends notification events: see wxRichTextEvent.
It also sends the standard wxTextCtrl events wxEVT_TEXT_ENTER and wxEVT_TEXT, and wxTextUrlEvent when URL content is clicked.
Using as a log
Most integrated development environments such as Visual Studio or Code::Blocks will output feedback from the compiler during build and display it in a text control. Do this when you want to output text...
void CustomFrame::OutputText(const char *text)
{
outputLogCtrl->AppendText(wxString::FromUTF8(text));
// repaints the control...
outputLogCtrl->ShowPosition(outputLogCtrl->GetLastPosition());
outputLogCtrl->Update();
}
And this for output followed by a newline...
void CustomFrame::OutputLine(const char *text)
{
outputLogCtrl->AppendText(wxString::FromUTF8(text) + _T("\n"));
// repaints the control...
outputLogCtrl->ShowPosition(outputLogCtrl->GetLastPosition());
outputLogCtrl->Update();
}
These functions first output text or text followed by a new line. Then they tell the control to scroll to the very bottom where the text was just appended and then force the control to repaint itself with "Update()".
See Also