[Lazarus] ComboBox bug?

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Sep 23 17:49:10 CEST 2011


On Fri, 23 Sep 2011 16:23:02 +0200
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

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

What else do you expect to happen?

 
>[...]
> 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?

I guess with 'Ansi' you mean system encoding. Where does the LCL use
system encoding?

Mattias




More information about the Lazarus mailing list