Set layout direction of wxComboBox edit control only if it exists.

Doesn't update layout direction of edit control if wxComboBox is in read-only
mode because editor control doesn't exist in this case.
This commit is contained in:
Artur Wieczorek
2015-03-13 19:10:20 +01:00
committed by Vadim Zeitlin
parent 6b84e6e1b9
commit 35379a9633

View File

@@ -716,17 +716,20 @@ void wxComboBox::SetLayoutDirection(wxLayoutDirection dir)
// extended style flags), so its layout direction should be set using the
// same extended flag as for ordinary window but reset simply with
// alignment flags.
if ( dir == wxLayout_RightToLeft )
if ( !HasFlag(wxCB_READONLY) )
{
wxUpdateLayoutDirection(GetEditHWND(), dir);
}
else
{
LONG_PTR style = ::GetWindowLongPtr(GetEditHWND(), GWL_STYLE);
if ( !(style & ES_CENTER) )
if ( dir == wxLayout_RightToLeft )
{
style &= ~ES_RIGHT;
::SetWindowLongPtr(GetEditHWND(), GWL_STYLE, style);
wxUpdateLayoutDirection(GetEditHWND(), dir);
}
else
{
LONG_PTR style = ::GetWindowLongPtr(GetEditHWND(), GWL_STYLE);
if ( !(style & ES_CENTER) )
{
style &= ~ES_RIGHT;
::SetWindowLongPtr(GetEditHWND(), GWL_STYLE, style);
}
}
}