On Thu, 22 Sep 2011 22:48:52 +0200
Hans-Peter Diettrich <[email protected]> wrote:
> Mattias Gaertner schrieb:
>
> >> Whenever the Sorted property is changed (SetSorted), UpdateSorted is
> >> called. It looks like UpdateSorted *always* sorts the list, as long as
> >> no handle (widget) has been created. This misbehaviour should affect at
> >> least the list items in design mode.
> >
> > What would be the right behavior?
>
> When Sorted is False, the items should not be sorted.
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.
lIndex := FItems.IndexOf(lText);
if lIndex >= 0 then
ItemIndex := lIndex;
end;
end;
Mattias
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus