[Lazarus] TComboBox.ReadOnly

Juha Manninen juha.manninen62 at gmail.com
Sat May 2 09:00:47 CEST 2020

On Sat, May 2, 2020 at 9:09 AM Ondrej Pokorny via lazarus <
lazarus at 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;
  Result := Style in [csDropDownList, csOwnerDrawFixed,

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200502/0c48dd29/attachment.html>

More information about the lazarus mailing list