Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Array Fehler (https://www.delphipraxis.net/16288-array-fehler.html)

Synonym 14. Feb 2004 12:41


Array Fehler
 
Was ist an meinem code Falsch?

Delphi-Quellcode:
var
x : integer;
newitem : array of Tmenuitem;
begin
plugin := tstringlist.create;
lade := tstringlist.create;
for x:= 0 to plugin.count - 1 do
begin
newitem[x] := tmenuitem.Create(self);
lade.LoadFromFile(plugin.strings[x]);
newitem[x].caption:= 'jo';
newitem[x].OnClick := holeinfos;
popupmenu1.items.add(newitem[x]);
end;

end;
synonym

neolithos 14. Feb 2004 12:43

Re: Array Fehler
 
Du hast das Dynamische Array nicht initialisiert!

-> SetLength

Synonym 14. Feb 2004 12:45

Re: Array Fehler
 
und wie muss ich das konkret bei meinem beispiel machen?

synonym

neolithos 14. Feb 2004 12:46

Re: Array Fehler
 
Delphi-Quellcode:
SetLength(newitem, plugin.count);
Vermute ich


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:15 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