Regarding issue:
 https://bugs.freepascal.org/view.php?id=36978

TComboBox ReadOnly was deprecated in r55243 by Ondrej at 2017-06-05.
No reason is mentioned but I believe it had good reasons.
The deprecated message was updated in r59467 by Mattias at 2018-11-06.

The deprecated message says: "use extended Style values instead."
How exactly should they be used to get the old ReadOnly behavior?

The deprecated message says the ReadOnly property will be removed in
Lazarus 2.2.
I removed it and fixed the numerous side effects. The changes are in the
attached patch.
There may be more side effects, I only tested with packages that happened
to be installed here.
Is it OK to apply?

Juha
From 74ded84dd5b5d9bb6f07ea9d6c77e90fa4470c91 Mon Sep 17 00:00:00 2001
From: Juha <juha.mannine...@gmail.com>
Date: Fri, 1 May 2020 12:45:07 +0300
Subject: [PATCH] LCL: Remove deprecated TComboBox.ReadOnly.

---
 components/tachart/tachartcombos.pas  | 1 -
 components/turbopower_ipro/iphtml.pas | 1 -
 lcl/colorbox.pas                      | 1 -
 lcl/include/comboex.inc               | 2 --
 lcl/include/customcombobox.inc        | 5 -----
 lcl/stdctrls.pp                       | 4 +---
 6 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/components/tachart/tachartcombos.pas b/components/tachart/tachartcombos.pas
index 9d1265c94..9f1897e48 100644
--- a/components/tachart/tachartcombos.pas
+++ b/components/tachart/tachartcombos.pas
@@ -234,7 +234,6 @@ constructor TChartComboBox.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
   DropdownCount := DEFAULT_DROPDOWN_COUNT;
-  ReadOnly := true;  // Needed to see the symbol without dropdown.
   Style := csOwnerDrawFixed;
   SetLength(FPenPattern, 2);
   FPenPattern[0] := 1;
diff --git a/components/turbopower_ipro/iphtml.pas b/components/turbopower_ipro/iphtml.pas
index fdce7771e..8ea476e72 100644
--- a/components/turbopower_ipro/iphtml.pas
+++ b/components/turbopower_ipro/iphtml.pas
@@ -12445,7 +12445,6 @@ begin
     AdjustControl;
     with TComboBox(FControl) do begin
       Style := csDropDownList;
-      ReadOnly := not FComboBox;
       OnEditingDone := ControlOnEditingdone;
     end;
   end;
diff --git a/lcl/colorbox.pas b/lcl/colorbox.pas
index 515f85b1a..f3e9044f7 100644
--- a/lcl/colorbox.pas
+++ b/lcl/colorbox.pas
@@ -381,7 +381,6 @@ constructor TCustomColorBox.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
   inherited Style := csOwnerDrawFixed;
-  inherited ReadOnly := True;
 
   FColorRectWidth := -1;
   FColorRectOffset := cDefaultColorRectOffset;
diff --git a/lcl/include/comboex.inc b/lcl/include/comboex.inc
index de2af4755..f24d91366 100644
--- a/lcl/include/comboex.inc
+++ b/lcl/include/comboex.inc
@@ -275,7 +275,6 @@ begin
   FAutoCompleteOptions:=cDefAutoCompOpts;
   FItemsEx:=TComboExItems.Create(self, TComboExItem);
   FNeedMeasure:=True;
-  ReadOnly:=True;
   inherited Style:=csOwnerDrawFixed;
   FStyle:=cDefStyle;
   FStyleEx:=[];
@@ -492,7 +491,6 @@ constructor TCustomCheckCombo.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
   TStringList(Items).Duplicates:=dupIgnore;
-  ReadOnly:=True;
   Style:=csOwnerDrawFixed;
   FNeedMeasure:=True;
   FRejectToggleOnSelect:=True;
diff --git a/lcl/include/customcombobox.inc b/lcl/include/customcombobox.inc
index e236923e2..649e8a52e 100644
--- a/lcl/include/customcombobox.inc
+++ b/lcl/include/customcombobox.inc
@@ -1091,11 +1091,6 @@ begin
   end;
 end;
 
-procedure TCustomComboBox.SetReadOnly(const AValue: Boolean);
-begin
-  // will be removed in 1.10
-end;
-
 {------------------------------------------------------------------------------
   procedure TCustomComboBox.UpdateSorted;
  ------------------------------------------------------------------------------}
diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp
index f00e146c1..feeda55d2 100644
--- a/lcl/stdctrls.pp
+++ b/lcl/stdctrls.pp
@@ -306,7 +306,6 @@ type
     procedure LMMeasureItem(var TheMessage: TLMMeasureItem); message LM_MeasureItem;
     procedure LMSelChange(var TheMessage); message LM_SelChange;
     procedure CNCommand(var TheMessage: TLMCommand); message CN_Command;
-    procedure SetReadOnly(const AValue: Boolean);
     procedure UpdateSorted;
     procedure SetArrowKeysTraverseList(Value: Boolean);
     procedure WMChar(var Message: TLMChar); message LM_CHAR;
@@ -404,7 +403,7 @@ type
     property DropDownCount: Integer read FDropDownCount write SetDropDownCount default 8;
     property Items: TStrings read FItems write SetItems;
     property ItemIndex: integer read GetItemIndex write SetItemIndex default -1;
-    property ReadOnly: Boolean read GetReadOnly write SetReadOnly stored False;
+    property ReadOnly: Boolean read GetReadOnly stored False;
     property SelLength: integer read GetSelLength write SetSelLength;// UTF-8 length
     property SelStart: integer read GetSelStart write SetSelStart;// UTF-8 position
     property SelText: String read GetSelText write SetSelText;
@@ -480,7 +479,6 @@ type
     property ParentFont;
     property ParentShowHint;
     property PopupMenu;
-    property ReadOnly; deprecated 'Will be removed in 2.2 - use extended Style values instead.';
     property ShowHint;
     property Sorted;
     property Style;
-- 
2.26.2

-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to