ComboHeight := ComboHeight replaced with UpdateComboHeight

git-svn-id: trunk@11077 -
This commit is contained in:
paul 2007-05-04 15:11:39 +00:00
parent fe4e668fd5
commit 051e47f08a
2 changed files with 15 additions and 12 deletions

View File

@ -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;

View File

@ -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;