[Lazarus] ComboBox bug?

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Sep 23 16:23:02 CEST 2011


Mattias Gaertner schrieb:
> Hans-Peter Diettrich <DrDiettrich1 at aol.com> hat am 23. September 2011 um 
> 05:40 geschrieben:
> 
>  > Mattias Gaertner schrieb:
>  >
>  > > procedure TCustomComboBox.UpdateSorted;
>  > > var
>  > >   lText: string;
>  > >   lIndex: integer;
>  > > begin
>  > >   if HandleAllocated then
>  > >     TWSCustomComboBoxClass(WidgetSetClass).Sort(Self, Items, FSorted)
>  > >   else if FItems is TStringList then
>  > >   begin
>  > >     // remember text
>  > >     lText := Text;
>  > >     TStringList(FItems).Sorted := FSorted;
>  > >
>  > > When not FSorted then items are not sorted.
>  >
>  > You're right.
>  >
>  > But the following then is also evitable (but does no harm):
>  >
>  > >     lIndex := FItems.IndexOf(lText);
>  > >     if lIndex >= 0 then
>  > >       ItemIndex := lIndex;
>  >
>  > What if lIndex=-1?
> 
>  
> 
> Nothing.

Obviously - but why?


Thanks for the fixes :-)


>  > Another (general) one:
>  >
>  > I found sometimes wrong descriptions for ...Length of strings,
>  > mentioning *byte* count instead of count in *logical* UTF-8 chars. How
>  > should such descriptions finally read?
>  >
>  > 1) Should a logical character count be implied, so that only really
>  > different (byte/AnsiChar) counts should be mentioned explicitly?
>  >
>  > 2) Should count in [logical?] [UTF-8?] characters be mentioned wherever
>  > applicable? [what about possible future change to Unicode/UTF-16?]
> 
>  
> 
> I think it should be mentioned wherever applicable. Of course it is 
> enough to add a link to a place where it is explained in detail.

I'm using the LCL since many years now, and I never noticed whether the 
LCL components use Ansi or UTF-8 strings. What's the default, and where 
is it (or should be) described?

DoDi





More information about the Lazarus mailing list