0

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

Saif
  • 231
  • 3
  • 13

2 Answers2

2

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.

New Pagodi
  • 3,484
  • 1
  • 14
  • 24
  • Thank you New Pagodi, yes they say that, they talking about old version!, now **wxWidgets 3.x** include latest version of **wxscintilla** and its support right-to-left languages `SetLayoutDirection(wxLayout_RightToLeft)` so I'm looking for a way to align text in Right, maybe by `StyleSetFont()` but i don't know how to do that.. if not maybe in the next version! – Saif Oct 24 '16 at 11:17
  • @Saif, did you try to ask on Scintilla forum or ML? – Igor Oct 24 '16 at 13:42
  • after reading your comment, i post one in **scintilla-interest** google group, thank you – Saif Oct 24 '16 at 14:40
1

Finlay, i fount that Scintilla support sample RTL by SetLayoutDirection (wxLayout_RightToLeft), but languages like Arabic/Japanese/Hebrew.. need BIDIRECTION DISPLAY to show characters correctly, and Scintilla doesn't have this feature right now.

So.. this feature is requested for development in future, but not proved right now LoL!.

https://sourceforge.net/p/scintilla/feature-requests/640/

https://groups.google.com/forum/#!topic/scintilla-interest/IfLfG3Zj_nY/discussion

Saif
  • 231
  • 3
  • 13