From 35379a9633e0bf9f112882776d51c306568b1e86 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 13 Mar 2015 19:10:20 +0100 Subject: [PATCH] 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. --- src/msw/combobox.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index f846184d63..f317ca3c01 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -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); + } } }