diff --git a/lcl/include/customcombobox.inc b/lcl/include/customcombobox.inc index 56e327c557..3a0070db6f 100644 --- a/lcl/include/customcombobox.inc +++ b/lcl/include/customcombobox.inc @@ -458,6 +458,23 @@ begin RegisterCustomComboBox; end; +procedure TCustomComboBox.CreateParams(var Params: TCreateParams); +const + ComboBoxStyles: array[TComboBoxStyle] of dword = ( + CBS_DROPDOWN, CBS_SIMPLE, CBS_DROPDOWNLIST, + CBS_OWNERDRAWFIXED, CBS_OWNERDRAWVARIABLE); + ComboBoxReadOnlyStyles: array[boolean] of dword = ( + CBS_DROPDOWN, CBS_DROPDOWNLIST); +begin + inherited CreateParams(Params); + Params.Style := Params.Style or (WS_VSCROLL or CBS_AUTOHSCROLL or CBS_HASSTRINGS) or + ComboBoxStyles[Style]; + if Style in [csOwnerDrawFixed, csOwnerDrawVariable] then + Params.Style := Params.Style or ComboBoxReadOnlyStyles[ReadOnly]; + if Sorted then + Params.Style := Params.Style or CBS_SORT; +end; + procedure TCustomComboBox.KeyDown(var Key: Word; Shift: TShiftState); var skip : Boolean; diff --git a/lcl/interfaces/win32/win32wsstdctrls.pp b/lcl/interfaces/win32/win32wsstdctrls.pp index c32c3318e1..d28b99522f 100644 --- a/lcl/interfaces/win32/win32wsstdctrls.pp +++ b/lcl/interfaces/win32/win32wsstdctrls.pp @@ -761,18 +761,14 @@ begin // customization of Params with Params do begin - Flags := Flags or CalcComboBoxWinFlags(TCustomComboBox(AWinControl)); - if TComboBox(AWinControl).Sorted Then - Flags:= Flags or CBS_SORT; pClassName := ComboboxClsName; pSubClassName := LCLComboboxClsName; - Flags := Flags or (WS_VSCROLL or CBS_AUTOHSCROLL or CBS_HASSTRINGS); SubClassWndProc := @ComboBoxWindowProc; end; // create window FinishCreateWindow(AWinControl, Params, False, True); - Info.cbSize:= SizeOf(Info); + Info.cbSize := SizeOf(Info); Win32Extra.GetComboBoxInfo(Params.Window, @Info); // get edit window within diff --git a/lcl/interfaces/wince/wincewsstdctrls.pp b/lcl/interfaces/wince/wincewsstdctrls.pp index 93d89a9b7d..6d620584f1 100644 --- a/lcl/interfaces/wince/wincewsstdctrls.pp +++ b/lcl/interfaces/wince/wincewsstdctrls.pp @@ -640,11 +640,9 @@ begin // customization of Params with Params do begin - Flags := Flags or CalcComboBoxWinFlags(TCustomComboBox(AWinControl)); - If TComboBox(AWinControl).Sorted Then - Flags:= Flags or CBS_SORT; + // remove unsupported styles + Flags := Flags and not (CBS_SIMPLE or CBS_OWNERDRAWFIXED or CBS_OWNERDRAWVARIABLE); pClassName := @ComboboxClsName; - Flags := Flags or (WS_VSCROLL or CBS_AUTOHSCROLL or CBS_HASSTRINGS); SubClassWndProc := @ComboBoxWindowProc; end; // create window diff --git a/lcl/lcltype.pp b/lcl/lcltype.pp index fea6d0b0c4..de3ab0751c 100644 --- a/lcl/lcltype.pp +++ b/lcl/lcltype.pp @@ -924,6 +924,16 @@ const ES_READONLY = $0800; ES_WANTRETURN = $1000; + { Combobox style } + CBS_SIMPLE = $0001; + CBS_DROPDOWN = $0002; + CBS_DROPDOWNLIST = $0003; + CBS_OWNERDRAWFIXED = $0010; + CBS_OWNERDRAWVARIABLE = $0020; + CBS_AUTOHSCROLL = $0040; + CBS_SORT = $0100; + CBS_HASSTRINGS = $0200; + const //============================================== // SetWindowPos Flags diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index 80c47971ed..b3dfe313fa 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -302,6 +302,7 @@ type procedure SetCharCase(eccCharCase: TEditCharCase); protected class procedure WSRegisterClass; override; + procedure CreateParams(var Params: TCreateParams); override; procedure InitializeWnd; override; procedure DestroyWnd; override; procedure DoEnter; override;