Hi there
I am trying to write a program in delphi (version 1) and I am coming across some
problems I cant seem to solve.
1) I would like to declare a constant of say 999999999999999, but the maximum I am
allowed to have is 9999999999. Is there a way around this? Will I have to declare it
as a variable and then allocate that larger number to it?
2) When it is compiling it tells me that the variables I am declaring are too big.
My declarations are (these constants are what I want to have):
const:
maxNodes = 200;
maxTechnologies = 100;
maxSuccessors = 50;
type
successorArrayType = array[1..maxSuccessors] of integer;
nodeRecord = record
number: integer;
demand: integer;
numberOfSuccessors: integer;
successorList: successorArrayType;
end;
nodeType = array[1..maxNodes] of nodeRecord;
technologyCapacityType = array[1..maxTechnologies] of integer;
compatibleTechType = array[1..maxTechnologies, 1..maxTechnologies] of boolean;
costRecord = record
fixed: real;
variable: real;
end;
technologyCostType = array[1..maxTechnologies] of costRecord;
HType = array[1..maxNodes, 1..maxTechnologies] of real;
GType = array[1..maxNodes, 1..maxNodes, 1..maxTechnologies] of integer;
When it is compiling it dies when it gets to GType.
If I change the constant declaration to something like:
const
maxNodes = 40
maxTechnologies = 20
maxSuccessors = 20
then it compilies OK, but this is way to small for what I want it to do. Is there a
way around this reseriction? (I read in the help that it allows only 64K for local and
64K for global variables, surely there is a way around this). A friend of mine said I
sould try using pointers , but I am not sure how to do that exactly, and when i tried
it it still died while compiling at the same place. (i wrote p = ^GType, but the
compiler had died before it reached that line of code)
3) I want to use an OpenDialog component, (and SaveDialog) but I cannot simply insert
one onto a form and use that because my unit will be stand alone and called from
possibly many different forms, none of which I can guarentee will contain an
OpenDialog or SaveDialog component. What I tried to do was in one of my procedures
declare:
procedure xxx(*****)
var
openFileDialog:TOpenDialog;
.....
begin
.....
if openFileDialog.Execute then .....
unfortunatly when I ran this (it compiled OK) I got the following error message box:
EGPFault.
"General protection fault in moduel project .exe at 0007:4a74. Process
stopped.
I looked this up and it said it is often due to objects not yet being created so I then
tried to insert the line:
TOpenDialog.Create(openFileDialog);
if openFileDialog.Execute then...
again it compiled OK, but when it got to the TOpenDialog.Create(openFileDialog) line I
got the same EGPFault error message box.
What am I doing wrong??
(I have included Dialogs in the uses declaration at the top of the unit)
4) Even if I remove all the big variable declarations, and if i pass in dialog boxes to
the open and save file routines (which I dont want to do but I just wanted to get my
code running) then the minute it hits the first begin in the very first routine the
program dies giving me the error "runtime error 202 at 0001:1099". (AARRGGGHHH!) I
cannot seem to find any reference to this error to explain what it means. Can someone
help me?
(at the moment what I have is a form with a single button on it and an open and save
dialog component on it. In my code there is an onbuttonclick routine which is meant to
start my code off, and it is at this begin that it dies).
all replies would be greatly appreciated
regards
andrew coyle