Hi!
I think you r right Rob!
i need to give complete information for getting
solution.
i am providing the code snippet from where i can think
the error is:
In Main.pas :
there is call to
'DisplayLoadedPackages' Procedure from within
Main.FormCreate(Sender : TObject).
This procedure now defined immediately below where
TMain.FormCreate() and then TMain.FormDestroy
completes.
Procedure TMain.DisplayLoadedPackages;
var
i, j:Integer;
DirID: Integer;
//Here SideLib is declared above as
//SIDELid : TDirectory as type in one other .pas file
//(havin no design).
for i:= 0 to SIDELib.DirCount-1 do begin
for j:= 0 to SIDELib.Directory[i].NumDataTypes-1
do begin
if SIDELib.Directory[i].PDataType[j].Name =
'TVector' then begin
if
Assigned(SIDELib.Directory[i].PDataType[j].EditorClass)
then begin
// here on executing the line given below, the error
//flashes as 'Access Violation at address xxxx... in
//module vcl30.dpl.read of address xxxx... Process
//Stopped. Use step or run to continue."
Edit3D:=SIDELib.Directory[i].PDataType[j].EditorClass.Create(Self);
end;
end;
// where Edit3D, TPlantType : TEditor;
if SIDELib.Directory[i].PDataType[j].Name =
'TPlantType' then begin
if
Assigned(SIDELib.Directory[i].PDataType[j].EditorClass)
then begin
//GreenhousePlanner
:=SIDELib.Directory[i].PDataType[j].EditorClass.Create(Self);
SIDELib.Directory[i].PDataType[j].EditorClass.Create(Self);
end;
end;
end;
TopPanelForm.DirList.Clear;
for DirID:=0 to SIDELib.DirCount-1 do begin
TopPanelForm.DirList.Add(SideLib.Directory[DirID]);
end;
TopPanelForm.LoadDirList;
end;
Now in LibInfo.pas :
TDirectory = class
private
FPDataTypes: TList;
FSysElClasses: TList;
function GetNumDataTypes: Integer;
virtual;
function GetPDataType(DTID: Integer): TPDataType;
virtual;
function GetNumSysElClasses: Integer;
function GetSysElClass(SEID: Integer):
TSysElClass;
function GetNumEditorClasses: Integer;
function GetEditorClass(EDID: Integer):
TEditorClass;
public
PathName: String;
constructor Create(PDataTypes : array of
TPDataType;
SysElClasses : array of
TSysElClass;
ReqdDirs : array of
ShortString;
UsedPubUnits : array of
ShortString;
UsedPriUnits : array of
ShortString); virtual;
property NumDataTypes: Integer read GetNumDataTypes;
property PDataType [DTID:Integer]: TPDataType read
GetPDataType; default;
property NumSysElClasses: Integer read
GetNumSysElClasses;
property SysElClass[SEID: Integer]: TSysElClass read
GetSysElClass;
property EditorClass[ECID: Integer]: TEditorClass
read GetEditorClass;
//then in
implementation
function TDirectory.GetPDataType(DTID:Integer):
TPDataType;
begin Result:= FPDataTypes[DTID];
end;
function TDirectory.GetNumEditorClasses: Integer;
begin Result:= FEditorClasses.Count;
end;
function TDirectory.Name: ShortString;
begin
Result:= GetName(PathName);
end;
procedure TDirectory.AddPDataType(PDataType:
TPDataType);
begin
FPDataTypes.Add(PDataType);
end;
function TDirectory.GetEditorClass(EDID: Integer):
TEditorClass;
begin Result:= FEditorClasses[EDID];
end;
Last but not least in SeTSysEl.pas File :
TEditor = class(TComponent)
protected
FSysEl: TSysEl; // Viewers are
Editors who don't
FPDynVar: TPDynVar;
FPDataType: TPDataType;
FConversionFactor: Single;
FStringField1, FStringField2, FStringField3,
FValString: String;
FPt: TPoint;
procedure SetSysEl(aSysEl: TSysEl); virtual;
abstract;
public
procedure Execute; virtual;
abstract;
property SysEl: TSysEl read FSysEl
write SetSysEl;
property PDynVar: TPDynVar read FPDynVar
write FPDynVar;
property PDataType: TPDataType read FPDataType
write FPDataType;
property StringField1: String read
FStringField1 write FStringField1;
property StringField2: String read
FStringField2 write FStringField2;
property StringField3: String read
FStringField3 write FStringField3;
property ValString: String read FValString
write FValString;
property Pt: TPoint read FPt
write FPt;
property ConversionFactor: Single read
FConversionFactor write FConversionFactor;
end;
TEditorClass = class of TEditor;
i think now you can solve my problem.
Looking forward for your reply.
thanks.
with regards
-Bijal...
--- Rob Kennedy <[EMAIL PROTECTED]> wrote:
---------------------------------
Bijal Mandviya wrote:
> i am trying alot on this but not able to do this.
> while running my delphi3 project under delphi5
> enviroment,first i am getting an run-time error as:
"
> Project Greenproj.exe raised exception class
> EAccessViolation with message 'access violation at
> address C08B0117. Read of address C08B0117'.Process
> stopped. Use step or run to continue"
A combination of addresses like that often indicates a
corrupt stack.
However, based on your further comments, it's more
likely an uninitialized
variable. Have you been ignoring compiler warnings?
> This error occurs at line when i m trying to invoke
a
> function.
> in that function, there is used Class1.Create(self);
> this Class1 is declared somewhere else as :
> Class1 : Class of TEditor;
> TEditor : Class(Tcomponent);
It's much more helpful if you copy and paste your
*real* code, instead of
trying to remember what your code is and then typing
it incorrectly into
your e-mail program.
I think Class1 is a valid variable declaration, but
TEditor is not. Even
though Class1 is valid, it's probably not what you
meant to write.
> and while looking inside this class, there is no
where
> written Constructor Create(.........
> Is it b'coz of this missing Create(), i m getting
> access violation?
If a method really doesn't exist, then your program
will not compile at
all. Remember that a class *inherits* all the
functionality of its
ancerstor class, so methods declared in the base class
are available to
all descendant classes, too.
> or is this b'coz of Class-reference that is not
> getting it's refernce properly?
Why are you working with class references at all?
The probably probably is with the class reference not
having a valid
value. The obvious thing to check, then, is where the
variable gets
assigned a value.
> please help me. i m very confussed and not even in
> position to move ahead.
> what should i do?
> is there any alternative to this?
We can't suggest alternatives unless you describe what
it is you're trying
to do and how you're trying to accomplish it.
--
Rob
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "delphi-en" on the web.
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo!
Terms of Service.
---------------------------------
__________________________________________________________
Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/