From 051e47f08a94e5ef600493cd4b73201c549e6bbc Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 4 May 2007 15:11:39 +0000 Subject: [PATCH] ComboHeight := ComboHeight replaced with UpdateComboHeight git-svn-id: trunk@11077 - --- lcl/interfaces/win32/win32listsl.inc | 21 +++++++++++---------- lcl/interfaces/win32/win32listslh.inc | 6 ++++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lcl/interfaces/win32/win32listsl.inc b/lcl/interfaces/win32/win32listsl.inc index e808d96fcb..d5754609c0 100644 --- a/lcl/interfaces/win32/win32listsl.inc +++ b/lcl/interfaces/win32/win32listsl.inc @@ -312,7 +312,7 @@ begin FDropDownCount := 8; end; -procedure TWin32ComboBoxStringList.Assign(Source: TPersistent); +procedure TWin32ComboBoxStringList.Assign(Source: TPersistent); var EditText: string; lItemIndex: integer; @@ -325,7 +325,7 @@ begin inherited Assign(Source); // restore text in edit box - ComboHeight := ComboHeight; + UpdateComboHeight; TWin32WSCustomComboBox.SetText(FSender, EditText); lItemIndex := IndexOf(EditText); if lItemIndex <> -1 then @@ -353,36 +353,37 @@ begin end; end; -procedure TWin32ComboBoxStringList.SetComboHeight(AValue: Integer); +procedure TWin32ComboBoxStringList.UpdateComboHeight; var - Left, Top, Width: integer; + Left, Top, Width, Height: integer; begin Left := FSender.Left; Top := FSender.Top; Width := FSender.Width; - LCLBoundsToWin32Bounds(FSender, Left, Top, Width, AValue); - MoveWindow(FSender.Handle, Left, Top, Width, AValue, true); + Height := ComboHeight; + LCLBoundsToWin32Bounds(FSender, Left, Top, Width, Height); + MoveWindow(FSender.Handle, Left, Top, Width, Height, true); LCLControlSizeNeedsUpdate(FSender, true); end; procedure TWin32ComboBoxStringList.Clear; begin inherited; - ComboHeight := ComboHeight; + UpdateComboHeight; end; procedure TWin32ComboBoxStringList.Delete(Index: integer); begin inherited Delete(Index); if Count <= 1 then - ComboHeight := ComboHeight; + UpdateComboHeight; end; procedure TWin32ComboBoxStringList.Insert(Index: integer; const S: string); begin inherited Insert(Index, S); - if GetCount = 0 then - ComboHeight := ComboHeight; + if GetCount = 1 then + UpdateComboHeight; end; diff --git a/lcl/interfaces/win32/win32listslh.inc b/lcl/interfaces/win32/win32listslh.inc index 83d99fabf2..83b3cd3608 100644 --- a/lcl/interfaces/win32/win32listslh.inc +++ b/lcl/interfaces/win32/win32listslh.inc @@ -75,6 +75,8 @@ Type Property Sorted: Boolean Read FSorted Write SetSorted; End; + { TWin32ComboBoxStringList } + TWin32ComboBoxStringList = class(TWin32ListStringList) private FEditHeight: Integer; @@ -82,15 +84,15 @@ Type FDropDownCount: Integer; protected function GetComboHeight: integer; - procedure SetComboHeight(AValue: Integer); procedure InitFlags; override; + procedure UpdateComboHeight; public procedure Assign(Source: TPersistent); override; procedure Clear; override; procedure Delete(Index: integer); override; procedure Insert(Index: integer; const S: string); override; - property ComboHeight: integer read GetComboHeight write SetComboHeight; + property ComboHeight: integer read GetComboHeight; end; PWin32CheckListBoxItemRecord = ^TWin32CheckListBoxItemRecord;