AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Delphi IsEmpty = True bei List.Count = 1
Thema durchsuchen
Ansicht
Themen-Optionen

IsEmpty = True bei List.Count = 1

Ein Thema von haentschman · begonnen am 14. Feb 2024 · letzter Beitrag vom 19. Feb 2024
Antwort Antwort
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.297 Beiträge
 
Delphi 12 Athens
 
#1

IsEmpty = True bei List.Count = 1

  Alt 14. Feb 2024, 07:42
Hallöle...

...verstehe ich nicht (siehe Bild).

Die WebFleetList ist eine abgeleitete TObjectList<TWebFleet>. In der Liste ist ein Objekt drin. Verschiedene Buttons (Delete z.b.) sind abhänging vom Inhalt der Liste. Ich wunderte mich, warum der Button disabled war, obwohl die Liste NICHT leer ist.

Ich benutze gern not List.IsEmpty statt List.Count > 0 ... das geht aber gerade in die Hose.

Hat Jemand eine Erklärung?

Danke...
Miniaturansicht angehängter Grafiken
empty.jpg  
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.150 Beiträge
 
Delphi 12 Athens
 
#2

AW: IsEmpty = True bei List.Count = 1

  Alt 14. Feb 2024, 08:22
Wo kommt DIESES FIsEmpty denn her?

Zitat:
Delphi-Quellcode:
property IsEmpty: Boolean read GetIsEmpty;

function TList<T>.GetIsEmpty: Boolean;
begin
  Result := FCount = 0;
end;
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.297 Beiträge
 
Delphi 12 Athens
 
#3

AW: IsEmpty = True bei List.Count = 1

  Alt 14. Feb 2024, 08:40
Zitat:
Wo kommt DIESES FIsEmpty denn her?
...aus TList<>

Ich habe KEIN eigenes IsEmpty implementiert. Meine Objektliste Liste erbt von TList.

Nachtrag:
Ich habe gelogen. Ich hätte schwören können, daß das IsEmpty aus TList kommt.

Tatsache seit 5 Jahren:
Delphi-Quellcode:
  TxxxxObjectList<T: class> = class(TObjectList<T>)
  strict private
  {$REGION 'Fields'}
    FChanged: Boolean;
    FIsLoading: Boolean;
    FIsEmpty: Boolean;
    FOnChange: TOnChangeEvent;
    procedure SetChanged(const Value: Boolean);
    procedure SetIsLoading(const Value: Boolean);
  {$ENDREGION}
  public
    constructor Create; overload; virtual;
    constructor Create(const AComparer: IComparer<T>); overload; virtual;
    property OnChange: TOnChangeEvent read FOnChange write FOnChange;
    property Changed: Boolean read FChanged write SetChanged;
    property IsLoading: Boolean read FIsLoading write SetIsLoading;
    property IsEmpty: Boolean read FIsEmpty write FIsEmpty; // -> würg
    procedure Clear; overload;
    function Add(const Value: T): Integer; overload;
    procedure Delete(Index: Integer); overload;
    function Remove(const Value: T): Integer; overload;
  end;
...wer mach denn so einen Schei...

Geändert von haentschman (14. Feb 2024 um 08:58 Uhr)
  Mit Zitat antworten Zitat
freimatz

Registriert seit: 20. Mai 2010
1.380 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: IsEmpty = True bei List.Count = 1

  Alt 19. Feb 2024, 14:22
Der MMX?
(wenn man die entsprechenden Optionen auswählt)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:55 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz