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

@ -325,7 +325,7 @@ begin
inherited Assign(Source); inherited Assign(Source);
// restore text in edit box // restore text in edit box
ComboHeight := ComboHeight; UpdateComboHeight;
TWin32WSCustomComboBox.SetText(FSender, EditText); TWin32WSCustomComboBox.SetText(FSender, EditText);
lItemIndex := IndexOf(EditText); lItemIndex := IndexOf(EditText);
if lItemIndex <> -1 then if lItemIndex <> -1 then
@ -353,36 +353,37 @@ begin
end; end;
end; end;
procedure TWin32ComboBoxStringList.SetComboHeight(AValue: Integer); procedure TWin32ComboBoxStringList.UpdateComboHeight;
var var
Left, Top, Width: integer; Left, Top, Width, Height: integer;
begin begin
Left := FSender.Left; Left := FSender.Left;
Top := FSender.Top; Top := FSender.Top;
Width := FSender.Width; Width := FSender.Width;
LCLBoundsToWin32Bounds(FSender, Left, Top, Width, AValue); Height := ComboHeight;
MoveWindow(FSender.Handle, Left, Top, Width, AValue, true); LCLBoundsToWin32Bounds(FSender, Left, Top, Width, Height);
MoveWindow(FSender.Handle, Left, Top, Width, Height, true);
LCLControlSizeNeedsUpdate(FSender, true); LCLControlSizeNeedsUpdate(FSender, true);
end; end;
procedure TWin32ComboBoxStringList.Clear; procedure TWin32ComboBoxStringList.Clear;
begin begin
inherited; inherited;
ComboHeight := ComboHeight; UpdateComboHeight;
end; end;
procedure TWin32ComboBoxStringList.Delete(Index: integer); procedure TWin32ComboBoxStringList.Delete(Index: integer);
begin begin
inherited Delete(Index); inherited Delete(Index);
if Count <= 1 then if Count <= 1 then
ComboHeight := ComboHeight; UpdateComboHeight;
end; end;
procedure TWin32ComboBoxStringList.Insert(Index: integer; const S: string); procedure TWin32ComboBoxStringList.Insert(Index: integer; const S: string);
begin begin
inherited Insert(Index, S); inherited Insert(Index, S);
if GetCount = 0 then if GetCount = 1 then
ComboHeight := ComboHeight; UpdateComboHeight;
end; end;

View File

@ -75,6 +75,8 @@ Type
Property Sorted: Boolean Read FSorted Write SetSorted; Property Sorted: Boolean Read FSorted Write SetSorted;
End; End;
{ TWin32ComboBoxStringList }
TWin32ComboBoxStringList = class(TWin32ListStringList) TWin32ComboBoxStringList = class(TWin32ListStringList)
private private
FEditHeight: Integer; FEditHeight: Integer;
@ -82,15 +84,15 @@ Type
FDropDownCount: Integer; FDropDownCount: Integer;
protected protected
function GetComboHeight: integer; function GetComboHeight: integer;
procedure SetComboHeight(AValue: Integer);
procedure InitFlags; override; procedure InitFlags; override;
procedure UpdateComboHeight;
public public
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure Clear; override; procedure Clear; override;
procedure Delete(Index: integer); override; procedure Delete(Index: integer); override;
procedure Insert(Index: integer; const S: string); override; procedure Insert(Index: integer; const S: string); override;
property ComboHeight: integer read GetComboHeight write SetComboHeight; property ComboHeight: integer read GetComboHeight;
end; end;
PWin32CheckListBoxItemRecord = ^TWin32CheckListBoxItemRecord; PWin32CheckListBoxItemRecord = ^TWin32CheckListBoxItemRecord;