I think what you've got is a dynamic array. So you need to call
SetLength(array,length) to initialise the array. You can avoid this by using a static
array (one declared with [1..100]).
The advantage of a static array is that it can be re-sized by another call to
SetLength(array,length).
This is inefficient because every time you call SetLength, it re-allocates the array
in memory, then copies the contents from the old allocation to the new one.
A better method is to initially declare the array big enough to fit what you expect to
put into it. Before doing the insert, check
Let's just fix the actual bug (worry about efficiency later)
DirMonArray[DmonCount - 1].Create(self); //= creation error here
of course it will crash..
try
DirMonArray[DmonCount - 1] := TDirMonitor.Create(self);
-Original Message-
From: Allan, Samuel [mailto:[EMAIL
Also.
Uses Contnrs (TComponentList, or TObjectList) might be a little easier than managing
an array, then you won't have
any dimension issues to worry about
-Original Message-
From: Alistair George [mailto:[EMAIL PROTECTED]
Sent: Monday, 31 March 2003 10:50 a.m.
To: Multiple recipients
Also, the array is of object references. So if you want to create a new
object in the array you need to do it like:
Array[x] := TMyObject.Create;
:-)
-Original Message-
From: Kyley Harris [mailto:[EMAIL PROTECTED]
Sent: Monday, 31 March 2003 11:38 a.m.
To: Multiple recipients of list
Wow, thanks all for that fine bunch of info. After scanning the internet the
info on this subject is not great, so the groups knowledge here has been of very
high standard!
Any chance of an example of the correct way to use the Tcomponentlist?
What I have done is:
declare:
var
Try
if TDirMonitor(DirMonList.Items[Tval]).Directory = CurrDir then Exit;
you probably need to cast the object to the correct type.
Dave.
-Original Message-
From: Alistair George [mailto:[EMAIL PROTECTED]
Sent: Monday, 31 March 2003 12:27 p.m.
To: Multiple recipients of list delphi
Well, Yes :) but i seem to have time delay issues with some of my emails and never saw
your original one :)
-Original Message-
From: Allan, Samuel [mailto:[EMAIL PROTECTED]
Sent: Monday, 31 March 2003 12:00 p.m.
To: Multiple recipients of list delphi
Subject: RE: RE: RE: Re: [DUG]: Array
Hi
I'm having trouble figuring out how to debug a visual control at design
time. I've created the source file VisualControl.pas and a new package
dcontrols.dpk which I've compiled and installed on the component pallet.
Now I want to catch the OnResizeEvent of my control at design time, when I
drop
Title: Reporting ... D5, from TDataset
I can
recommend fastreport:
http://www.fast-report.com/en/index.php
regards,
Steve
-Original Message-From: James Low
[mailto:[EMAIL PROTECTED]Sent: Monday, 31 March 2003 01:14
p.m.To: Multiple recipients of list delphiSubject:
[DUG]:
Casting is good. You really want to subclass TComponentList. (it doesn't take long)
ie. example
TEditPanels = class(TComponentList)
function GetItems(Index: Integer): TEditPanel;
procedure SetItems(Index: Integer; const Value: TEditPanel);
public
function Add(AComponent:
11 matches
Mail list logo