[Lazarus] Strange ComboBox behavior (Windows)

Rolf Wetjen(rolf.wetjen@mail.de) rolf.wetjen at mail.de
Tue Feb 20 08:40:58 CET 2018


Hi Lazarus team,

I've two issues with a ComboBox (csDropDown) control in Windows:

1. ComboBox.AutoSelect:=false isn't working. I seems that Windows always 
selects the whole ComboBox.Text at activation of the control.

2. Changing the ComboBox.Font (.Style, .Size or .Color) overwrites the 
ComboBox.Text with the first matching item of ComboBox.Items.
ComboBox.Style is csDropDown. Look at this code:

procedure TForm1.SpeedButtonTestClick (Sender: TObject);
begin
   ComboBox1.Clear;
   ComboBox1.Items.Add('Item0');
   ComboBox1.Items.Add('TestItem1');
   ComboBox1.Items.Add('Item2');
   ComboBox1.Text:='Test';
   if fsBold in ComboBox1.Font.Style then
     ComboBox1.Font.Style:=ComboBox1.Font.Style-[fsBold]
   else
     ComboBox1.Font.Style:=ComboBox1.Font.Style+[fsBold];
end;

ComboBox1.Text is set to 'TestItem1'.

I'd a good look into customcombobox.inc and win32wsstdctrls.pp (Windows 
10 x64, Lazarus 1.9 57316) trying to analyse this without any idea. 
Meanwhile I think that both issues are MS Windows ones. But I don't have 
a Linux environment to check it. Maybe someone else can do?

Is there any interest in a patch to solve MS Windows issues although the 
patch would add some windows specific code to stdctrls.pp and 
customcombobox.inc? I've a solution for the "AutoSelect=false" one and 
an idea for the second one.

Rolf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180220/8320e258/attachment.html>


More information about the Lazarus mailing list