Einzelnen Beitrag anzeigen

Pawel Piotrowski

Registriert seit: 13. Aug 2003
9 Beiträge
 
#37

AW: Massive Performanceprobleme mit TJvImageComboBox

  Alt 15. Sep 2019, 20:19
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;
Pawel Piotrowski

Geändert von Pawel Piotrowski (15. Sep 2019 um 20:28 Uhr)
  Mit Zitat antworten Zitat