mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-02 21:07:35 +01:00
win32:
- update combobox interface constraints on WM_SIZE message, - fix combobox window proc - it had double processing for some messages - don't use FItemHeight, FEditHeight stored on initialization - they can be not valid if something has changed (like font, theme, metrics) git-svn-id: trunk@29880 -
This commit is contained in:
parent
af80e73948
commit
7214b124da
@ -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;
|
||||
|
||||
|
||||
@ -81,8 +81,6 @@ Type
|
||||
|
||||
TWin32ComboBoxStringList = class(TWin32ListStringList)
|
||||
private
|
||||
FEditHeight: Integer;
|
||||
FItemHeight: Integer;
|
||||
FDropDownCount: Integer;
|
||||
procedure SetDropDownCount(const AValue: integer);
|
||||
protected
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user