On Sat, May 2, 2020 at 9:09 AM Ondrej Pokorny via lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> 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.)
>

No, the published property is gone. You must rebuild the IDE before it
disappears from OI.
There is a public TCustomComboBox.ReadOnly :

    property ReadOnly: Boolean read GetReadOnly stored False;
...
function TCustomComboBox.GetReadOnly: Boolean;
begin
  Result := Style in [csDropDownList, csOwnerDrawFixed,
csOwnerDrawVariable];
end;


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

Works only with LCL-Win32.
I just realized that a custom cross-platform component could easily be
inherited from TCustomEditButton. It is the ancestor of TFilenameEdit,
TDateEdit etc.
It makes sense if you need many instances of those controls. Otherwise a
TEdit + anchored dropdown button suffices.
Such a custom component will not be added to LCL however because TComboBox
and TComboBoxEx are enough for most people.

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

Reply via email to