Re: [Lazarus] TComboBox.ReadOnly

2020-05-02 Thread Werner Pamler via lazarus

Am 02.05.2020 um 16:15 schrieb Juha Manninen via lazarus:

Ok, I removed it in r63112.


Something must be screwed up in TComboboxEx. Don't worry, not by the 
removal of the ReadOnly property, but it must have been around for a 
long time since the beginning: This component introduces a new Style 
type: TComboboxExStyle = (csExDropDown, csExSimple, csExDropDownList). 
In Delphi it is possible to type text into the control when the Style is 
csExDropDown or csExSimple, but in Lazarus this is not possible, the 
control behaves like csExDropDownList in all cases (except for the 
grayed appearance, in Windows). And in Delphi the Style with csExSimple 
looks like a simple TEdit, while in Lazarus it has the dropdown arrow, 
like the csExDropdown(List) Style.


I tested this on Windows, and Linux gtk2 and qt5.

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


Re: [Lazarus] TComboBox.ReadOnly

2020-05-02 Thread Ondrej Pokorny via lazarus

On 02.05.2020 16:15, Juha Manninen via lazarus wrote:
On Sat, May 2, 2020 at 11:37 AM Ondrej Pokorny via lazarus 
mailto:lazarus@lists.lazarus-ide.org>> 
wrote:


Yes, sorry - you are right. I missed that. I would just remove it.


Ok, I removed it in r63112.


Great, thank you, Juha!

Ondrej

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


Re: [Lazarus] TComboBox.ReadOnly

2020-05-02 Thread Juha Manninen via lazarus
On Sat, May 2, 2020 at 11:37 AM Ondrej Pokorny via lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> Yes, sorry - you are right. I missed that. I would just remove it.
>

Ok, I removed it in r63112.

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


Re: [Lazarus] TComboBox.ReadOnly

2020-05-02 Thread Ondrej Pokorny via lazarus

On 02.05.2020 09:00, Juha Manninen via lazarus wrote:
On Sat, May 2, 2020 at 9:09 AM Ondrej Pokorny via lazarus 
mailto: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


Yes, sorry - you are right. I missed that. I would just remove it.



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.


That's obvious :) I wanted to stress that we never had a ReadOnly 
property Jamie wanted so there was nothing to be re-enabled. Also, 
Delphi never had it so he was wrong about "I understand latest Delphi 
eliminated it [ReadOnly property]".


Ondrej

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


Re: [Lazarus] TComboBox.ReadOnly

2020-05-02 Thread Juha Manninen via lazarus
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


Re: [Lazarus] TComboBox.ReadOnly

2020-05-02 Thread Ondrej Pokorny via lazarus

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

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


Re: [Lazarus] TComboBox.ReadOnly

2020-05-01 Thread Juha Manninen via lazarus
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.

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