[Lazarus] ComboBox bug?
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Sep 22 22:06:53 CEST 2011
On Thu, 22 Sep 2011 22:48:52 +0200
Hans-Peter Diettrich <DrDiettrich1 at aol.com> 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
More information about the Lazarus
mailing list