From 1e64a65808d5e534f589d55fc631a6a3e2836e32 Mon Sep 17 00:00:00 2001 From: Jesus Reyes A Date: Wed, 25 Aug 2021 00:58:24 -0500 Subject: [PATCH] LCL: Deprecated TDBLookupComboBox DropDownCount property in favor of DropDownRows to improve delphi compatibility, issue #35864 --- lcl/dbctrls.pp | 7 ++++++- lcl/include/dblookupcombobox.inc | 26 ++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/lcl/dbctrls.pp b/lcl/dbctrls.pp index c6fe5f8eca..62e8a1ad22 100644 --- a/lcl/dbctrls.pp +++ b/lcl/dbctrls.pp @@ -860,12 +860,14 @@ Type TDBLookupComboBox = class(TCustomDBComboBox) protected + procedure DefineProperties(Filer: TFiler); override; function DoEdit: boolean; override; function IsUnbound: boolean; private FLookup: TDBLookup; procedure ActiveChange(Sender: TObject); function GetDisplayEmpty: String; + function GetDropDownRows: Integer; function GetEmptyValue: String; function GetKeyField: string; function GetKeyValue: variant; @@ -875,7 +877,9 @@ Type function GetLookupCache: boolean; function GetNullValueKey: TShortCut; function GetScrollListDataset: Boolean; + procedure ReadDropDownCount(Reader: TReader); procedure SetDisplayEmpty(AValue: String); + procedure SetDropDownRows(AValue: Integer); procedure SetEmptyValue(AValue: String); procedure SetKeyField(const Value: string); procedure SetKeyValue(const AValue: variant); @@ -899,6 +903,7 @@ Type public constructor Create(AOwner: TComponent); override; property KeyValue: variant read GetKeyValue write SetKeyValue; + property DropDownCount; deprecated 'Use DropDownRows'; published property Align; property Anchors; @@ -920,7 +925,7 @@ Type property DragCursor; property DragKind; property DragMode; - property DropDownCount; + property DropDownRows: Integer read GetDropDownRows write SetDropDownRows default 7; property Enabled; property Font; // property ItemHeight; diff --git a/lcl/include/dblookupcombobox.inc b/lcl/include/dblookupcombobox.inc index 66753161ef..b019aa3c94 100644 --- a/lcl/include/dblookupcombobox.inc +++ b/lcl/include/dblookupcombobox.inc @@ -24,6 +24,7 @@ begin EmptyValue := ''; DisplayEmpty := ''; FDataLink.OnActiveChange := @ActiveChange; + inherited DropDownCount := 7; end; procedure TDBLookupComboBox.UpdateData(Sender: TObject); @@ -43,6 +44,12 @@ begin UpdateLookup; end; +procedure TDBLookupComboBox.DefineProperties(Filer: TFiler); +begin + inherited DefineProperties(Filer); + Filer.DefineProperty('DropDownCount', @ReadDropDownCount, nil, false); +end; + function TDBLookupComboBox.DoEdit: boolean; begin if IsUnbound then begin @@ -73,7 +80,12 @@ begin Result := FLookup.DisplayEmpty; end; -function TDBLookupComboBox.GetEmptyValue: string; +function TDBLookupComboBox.GetDropDownRows: Integer; +begin + result := inherited DropDownCount; +end; + +function TDBLookupComboBox.GetEmptyValue: String; begin Result := FLookup.EmptyValue; end; @@ -169,7 +181,12 @@ begin UpdateLookup; end; -procedure TDBLookupComboBox.SetEmptyValue(AValue: string); +procedure TDBLookupComboBox.SetDropDownRows(AValue: Integer); +begin + inherited DropDownCount := AValue; +end; + +procedure TDBLookupComboBox.SetEmptyValue(AValue: String); begin FLookup.EmptyValue:=AValue; UpdateLookup; @@ -180,6 +197,11 @@ begin Result := FLookup.ScrollListDataset; end; +procedure TDBLookupComboBox.ReadDropDownCount(Reader: TReader); +begin + inherited DropDownCount := Reader.ReadInteger; +end; + procedure TDBLookupComboBox.SetKeyField(const Value: string); begin FLookup.KeyField := Value;