Search code examples
c++wxwidgetswxstyledtextctrl

wxWidgets - wxStyledTextCtrl - Text alignment RTL


wxStyledTextCtrl is very good, but not fully documented.. any one know how to align text in Right ?

// To create one
this->STYLED_TEXT = new wxStyledTextCtrl(PANEL, wxID_ANY, wxDefaultPosition, wxSize(500, 500));

// To set it RTL
STYLED_TEXT->SetLayoutDirection(wxLayout_RightToLeft);

The question.. how to align text in Right please ?

This didn't work!

this->STYLED_TEXT = new wxStyledTextCtrl(PANEL, wxID_ANY, wxDefaultPosition, wxSize(500, 500), wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxRIGHT);

Thank in advance


Solution

  • This can't be done. wxStyledTextCtrl is a wrapper for the Scintilla text editor. It's really meant for writing in source code languages and not natural human languages. As they state on their site:

    Scintilla does not properly support right-to-left languages like Arabic and Hebrew. While text in these languages may appear correct, it is not possible to interact with this text as is normal with other editing components.

    Maybe wxRichTextCtrl might work instead.