Opened 4 years ago

Closed 4 years ago

#17701 closed defect (wontfix)

wxTextCtrl - (RTL) Right to left Reading order text selection

Reported by: hassandraga Owned by:
Priority: normal Milestone:
Component: wxRichText Version: 3.0.2
Keywords: RTL Cc:
Blocked By: Blocking:
Patch: no

Description

Hello, as we know wxTextCtrl can show Unicode text correctly, and also show Layout correctly (Right to left Reading), the only issues one is BIDIRECTIONAL display (mix of LTR and RTL text), same issues for wxStyledTextCtrl (Scintilla).

BIDIRECTIONAL problem is when you select or write mixed text like English and Arabic.

But i found a way (without Patch) to show Unicode text correctly with BIDIRECTIONAL display!

[1] Create an wxTextCtrl without any RTL flag (WS_EX_LAYOUTRTL, WS_EX_RTLREADING...).

TXT = new wxTextCtrl(PANEL, wxID_ANY, wxT(""), wxPoint(0, 250), wxSize(500, 500), wxTE_MULTILINE);

[2] Set Layout Direction as Left to right.

TXT->SetLayoutDirection(wxLayout_LeftToRight);

[3] Build and run!

[4] Text show in left way!, but right click, then click on Right to left Reading order.

This will show text in right, with full BIDIRECTIONAL feature!.

So, when i tray to do that in code, the text show in right, but without BIDIRECTIONAL feature!.

TXT = new wxTextCtrl(PANEL, wxID_ANY, wxT(""), wxPoint(0, 250), wxSize(500, 500), wxTE_MULTILINE | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR | WS_EX_LAYOUTRTL | wxTE_RIGHT);

TXT->SetLayoutDirection(wxLayout_RightToLeft);

Attachments (1)

bug.png download (10.8 KB) - added by hassandraga 4 years ago.
RTL fixed by [Right to left Reading order] menu

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by hassandraga

RTL fixed by [Right to left Reading order] menu

comment:1 Changed 4 years ago by vaclavslavik

For reference, the right way to do it is with EM_SETBIDIOPTIONS and EM_SETEDITSTYLE. Like this: https://github.com/vslavik/poedit/blob/b0ce16b6c6f9a562580f8f6afa1c0960c7c8bad5/src/text_control.cpp#L536

Scintilla is simply not RTL aware, nothing wx can do about it: http://www.scintilla.org/ScintillaDoc.html

comment:2 Changed 4 years ago by hassandraga

Thank you vaclavslavik

Last edited 4 years ago by hassandraga (previous) (diff)

comment:3 Changed 4 years ago by hassandraga

  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.