Reputation: 45
I have a problem that I have a form which includes three pages (or forms), two pages are Persian in RTL direction and one of them is LTR. I set my parent form in RTL mode like this:
if (Create( CWnd::FromHandle(hWndParent),
WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME | WS_VISIBLE | DS_CONTEXTHELP ,
WS_EX_LAYOUTRTL | WS_EX_CONTROLPARENT | WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME ) == 0 )
return IDCANCEL;
And all of my pages turn into the RTL mode. In that English page I have a listcntrl that have to be in LTR mode, so I write this code in the English page class:
LONG lStyle = ::GetWindowLong(GetDlgItem(IDC_LST_ITEMS)->m_hWnd,GWL_EXSTYLE);
lStyle &= ~WS_EX_LAYOUTRTL;
::SetWindowLong(GetDlgItem(IDC_LST_ITEMS)->m_hWnd, GWL_EXSTYLE, lStyle);
Actually all the items included in my list control change to LTR, but my header and column are RTL.
How can I fix this problem?
Upvotes: 1
Views: 63
Reputation: 31609
You can change the flag in dialog editor's "Properties Window". In dialog editor, open the target dialog, click the ListView control, hit F4 key, set "Right Align Text" to false for ListView control.
If you change it through code, you probably also need the handle to ListView's header control:
HWND hHeader = ListView_GetHeader(hListView);
LONG lStyle = ::GetWindowLong(hHeader, GWL_EXSTYLE);
lStyle &= ~WS_EX_LAYOUTRTL;
::SetWindowLong(hHeader, GWL_EXSTYLE, lStyle);
Upvotes: 1