Nein. Damit schaltest Du das sortieren ganz ab.
Mache es so:
Delphi-Quellcode:
procedure TJvImageItem.SetText(const Value: string);
var
S: TStrings;
SavedOwner: TJvImageItems;
begin
S := GetOwnerStrings;
if Assigned(FOwner) and (FOwner.FStrings.Count <> FOwner.Count) then
FOwner.FillItems;
if S <> nil then
begin
if S[Index] <> Value then
begin
// do not add the item in FillItems which might be called by the draw message handler while deleting the string
SavedOwner := FOwner;
try
FOwner := nil;
// S.Delete(Index); - nicht hier
if (SavedOwner.GetOwner is TJvImageListBox) and (TJvImageListBox(SavedOwner.GetOwner).Sorted) then
begin
S.Delete(Index); // hier besser
Index := S.AddObject(Value, Self);
end else
S[Index]:= value; // reicht doch
finally
FOwner := SavedOwner;
end;
// Index := S.IndexOfObject(Self);
Change;
end;
end;
end;