![]() |
Generic Component mit dynamischem Array geht nicht
Eine generic Componente mit dynamischen Array compiliert zwar ohne Fehlermeldung, nur beim Testen gubt es einen Absturz.
Die Ursache ist ein fehlerhafter Wert für Length(Items), wenn Items ein dynamisches Array ist. Falls jemand dazu eine Idee hat, so bitte um Mitteilung. Lg Frizzi Type THFArrayBase<GItem> = class( ... FArray :Array of GItem; Type THFByteArray = Class(THFArrayBase(Byte) ... Procedure THFArrayBase<GItem>.Add(const Item:GItem); Begin SetLength(FArray,Length(FArray)+1); FArray[High(FArray)] := Item; If FSortDir <> sdNone then Sort; End; Procedure THFArrayBase.Add(const Items:Array of GItem); Var Inx,aLng,iLng :Integer; Begin aLng := Length(FArray); iLng := Length(Items); //ergibt irgendeinen Fantasiewert SetLength(FArray,aLng+iLng); For Inx := 0 to High(Items) do FArray[aLng+Inx] := Items[Inx]; If FSortDir <> sdNone then Sort; End; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:01 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz