Einzelnen Beitrag anzeigen

Benutzerbild von sh17
sh17

Registriert seit: 26. Okt 2005
Ort: Radebeul
1.643 Beiträge
 
Delphi 11 Alexandria
 
#4

Re: TObjectList Suchen nach String

  Alt 30. Nov 2005, 14:28
kleiner Tipp, wenn Du Dir das Casten sparen willst:

eine TImage-Objectliste

Delphi-Quellcode:
interface

type
TImageObjectList = class(TObjectList)
protected
  function GetItem(Index: Integer): TImage;
  procedure SetItem(Index: Integer; AItem: TImage);
public
  function Add(AItem: TImage): Integer;
  function Extract(Item: TImage): TImage;
  function Remove(AItem: TImage): Integer;
  function IndexOf(AItem: TImage): Integer;
  procedure Insert(Index: Integer; AItem: TImage);
  function First: TImage;
  function Last: TImage;
  property Items[Index: Integer]: TImage read GetItem write SetItem; default;
end;

implementation

{ TImageObjectList }

function TImageObjectList.Add(AItem: TImage): Integer;
begin Result := inherited Add(AItem); end;

function TImageObjectList.Extract(Item: TImage): TImage;
begin Result := TImage(inherited Extract(Item)); end;

function TImageObjectList.First: TImage;
begin Result := TImage(inherited First); end;

function TImageObjectList.GetItem(Index: Integer): TImage;
begin Result := TImage(inherited Items[Index]); end;

function TImageObjectList.IndexOf(AItem: TImage): Integer;
begin Result := inherited IndexOf(AItem); end;

procedure TImageObjectList.Insert(Index: Integer; AItem: TImage);
begin inherited Insert(Index, AItem); end;

function TImageObjectList.Last: TImage;
begin Result := TImage(inherited Last); end;

procedure TImageObjectList.SetItem(Index: Integer; AItem: TImage);
begin inherited Items[Index] := AItem; end;

function TImageObjectList.Remove(AItem: TImage): Integer;
begin Result := inherited Remove(AItem);end;
Sven Harazim
--
  Mit Zitat antworten Zitat