diff --git a/lcl/interfaces/win32/win32listsl.inc b/lcl/interfaces/win32/win32listsl.inc index 4970388afb..7d1c229984 100644 --- a/lcl/interfaces/win32/win32listsl.inc +++ b/lcl/interfaces/win32/win32listsl.inc @@ -351,9 +351,6 @@ begin FFlagSetSelected := UINT(0); FFlagInitStorage := UINT(CB_INITSTORAGE); //Get edit and item sizes - Windows.GetClientRect(FWin32List, @R); - FEditHeight := R.Bottom; - FItemHeight := Windows.SendMessage(FWin32List, CB_GETITEMHEIGHT, 0, 0); FDropDownCount := TCustomComboBox(FSender).DropDownCount; if FDropDownCount = 0 then FDropDownCount := 8; @@ -375,7 +372,7 @@ begin UpdateComboHeight; TWin32WSCustomComboBox.SetText(FSender, EditText); if EditText = '' then - lItemIndex := -1 + lItemIndex := -1 else lItemIndex := IndexOf(EditText); if lItemIndex <> -1 then @@ -387,11 +384,13 @@ end; procedure TWin32ComboBoxStringList.SetDropDownCount(const AValue: integer); begin - FDropDownCount:=AValue; + FDropDownCount := AValue; UpdateComboHeight; end; function TWin32ComboBoxStringList.GetComboHeight: integer; +var + R: TRect; begin if (FSender is TCustomComboBox) and (TCustomComboBox(FSender).Style = csSimple) then begin @@ -400,10 +399,11 @@ begin Result := FSender.Height; end else begin + Windows.GetClientRect(FWin32List, @R); if Count = 0 then - Result := FEditHeight + FItemHeight + 2 + Result := R.Bottom + Windows.SendMessage(FWin32List, CB_GETITEMHEIGHT, 0, 0) + 2 else - Result := FEditHeight + FDropDownCount * FItemHeight + 2; + Result := R.Bottom + FDropDownCount * Windows.SendMessage(FWin32List, CB_GETITEMHEIGHT, 0, 0) + 2; end; end; diff --git a/lcl/interfaces/win32/win32listslh.inc b/lcl/interfaces/win32/win32listslh.inc index 7d153afd28..6c0779e245 100644 --- a/lcl/interfaces/win32/win32listslh.inc +++ b/lcl/interfaces/win32/win32listslh.inc @@ -81,8 +81,6 @@ Type TWin32ComboBoxStringList = class(TWin32ListStringList) private - FEditHeight: Integer; - FItemHeight: Integer; FDropDownCount: Integer; procedure SetDropDownCount(const AValue: integer); protected diff --git a/lcl/interfaces/win32/win32wsstdctrls.pp b/lcl/interfaces/win32/win32wsstdctrls.pp index 68f5be58f5..3c4afa8f3a 100644 --- a/lcl/interfaces/win32/win32wsstdctrls.pp +++ b/lcl/interfaces/win32/win32wsstdctrls.pp @@ -74,7 +74,7 @@ type private class function GetStringList(const ACustomComboBox: TCustomComboBox): TWin32ComboBoxStringList; published - class function CreateHandle(const AWinControl: TWinControl; + class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND; override; class procedure AdaptBounds(const AWinControl: TWinControl; var Left, Top, Width, Height: integer; var SuppressMove: boolean); override; @@ -379,8 +379,7 @@ begin if (HWND(WParam) = Info.hwndItem) or (HWND(WParam) = Info.hwndList) then begin // continue normal processing, don't send to lcl - Result := CallDefaultWindowProc(Window, Msg, WParam, LParam); - Exit; + Exit(CallDefaultWindowProc(Window, Msg, WParam, LParam)); end; end; WM_PAINT, @@ -393,13 +392,18 @@ begin LMessage.wParam := WParam; LMessage.lParam := LParam; LMessage.Result := 0; - Result := DeliverMessage(WindowInfo^.WinControl, LMessage); + Exit(DeliverMessage(WindowInfo^.WinControl, LMessage)); end else - Result := WindowProc(Window, Msg, WParam, LParam); + Exit(WindowProc(Window, Msg, WParam, LParam)); end; WM_PRINTCLIENT: - Result := CallDefaultWindowProc(Window, Msg, WParam, LParam); + Exit(CallDefaultWindowProc(Window, Msg, WParam, LParam)); + WM_SIZE: + begin + WindowInfo := GetWin32WindowInfo(Window); + WindowInfo^.WinControl.Constraints.UpdateInterfaceConstraints; + end; end; // normal processing Result := WindowProc(Window, Msg, WParam, LParam); @@ -842,10 +846,9 @@ class procedure TWin32WSCustomComboBox.AdaptBounds(const AWinControl: TWinContro var StringList: TWin32ComboBoxStringList; begin - if TCustomComboBox(AWinControl).Style=csSimple - then exit; + if TCustomComboBox(AWinControl).Style = csSimple then Exit; StringList := GetStringList(TCustomComboBox(AWinControl)); - if StringList <> nil then + if Assigned(StringList) then Height := StringList.ComboHeight; end;