[Lazarus] TComboBox.ReadOnly
Ondrej Pokorny
lazarus at kluug.net
Sat May 2 08:09:33 CEST 2020
On 01.05.2020 23:36, Juha Manninen via lazarus wrote:
> I applied my own patch. It removes the deprecated published property
> so it will be gone in Lazarus 2.2. A public ReadOnly property remains
> but is cannot be assigned any more. Thus ReadOnly property is itself
> readonly. :)
> Please test.
From what I can see the ReadOnly property is still published. I would
remove it completely, there is no reason to have it anymore if it was
deprecated for 3 years. Not even in the public section. (Again, even
with ReadOnly=True you can still change the value with the drop down.)
As for Jamie's issue. I took a look at the state before I deprecated it
and it was a way to disable editing for csOwnerDrawFixed,
csOwnerDrawVariable styles - so actually a duplicate property for the
Style property. It had no other function.
It was not an equivalent for a "readonly edit" (=you can select text but
cannot change it by typing) and enabled drop-down list. Something that
can be achieved with EM_SETREADONLY as described in
http://mc-computing.com/Languages/Delphi/ReadOnly.html
This works in Lazarus as well:
procedure TForm1.Button1Click(Sender: TObject);
begin
// make combobox read-only (make sure ComboBox1.Style=csDropDown)
SendMessage(GetWindow(ComboBox1.Handle, GW_CHILD), EM_SETREADONLY,
Ord(True), 0);
end;
So, IMO the removal of the ReadOnly property is valid because it was not
implemented with EM_SETREADONLY as Jamie expected and was only confusing
the way it was implemented.
Ondrej
More information about the lazarus
mailing list