Mattias Gaertner schrieb:
On Fri, 23 Sep 2011 16:23:02 +0200
Hans-Peter Diettrich <[email protected]> wrote:
Mattias Gaertner schrieb:
Hans-Peter Diettrich <[email protected]> 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 wonder e.g. why ItemIndex is not tested before all further processing.
When nothing has been selected before sorting, then after sorting
nothing should be/become selected as well.
[...]
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?
I'm just asking. I think that I've seen such behaviour somewhere, will
watch for concrete occurences.
DoDi
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus