Hi,
Application is complete and works fine. However, nagging suspicion my code is very inefficient and 'clunky' if you know what i mean.
The body of my app handles several different images, each of which is displayed in turn. For each image, there is a unique name, several unique string / integer / real / array variables. At the moment I have a counter which informs the code which image is being analysed. Then I have a huge long list of:
If imagecounter:=1 then...
Namelabel.caption:='Image1'
Image1X:=
Image1Y:=
... main procedure...
If imagecounter:=2 then...
Namelabel.caption:='Image2'
Image2.X:=
Image3.Y:=
... main procedure...
etc.
So, my 'main procedure' occurs many times in the code, for each possible count of imagecounter.
I know i can set my 'main procedure' up as a procedure on it's own, and am happy sending variable to and from it. However, how can you have 'variable dependent variables'??
For instance, how can my seperate main procedure read in the image counter, and then modify the appropriate variables for that image without directly specifying it in a load of if.. then statements?
Can you have a 'look up' table of variable names? Can you have a variable which 'points' to the appropriate variable name?
I am sure this is just a conceptual thing in Delphi I am not fmailiar with, and i hope I have explained myself clearly.
Altough my app works great, and is only 2Mb in size, i would still like to tidy it up and optimise the code if I can.
Thanks
Application is complete and works fine. However, nagging suspicion my code is very inefficient and 'clunky' if you know what i mean.
The body of my app handles several different images, each of which is displayed in turn. For each image, there is a unique name, several unique string / integer / real / array variables. At the moment I have a counter which informs the code which image is being analysed. Then I have a huge long list of:
If imagecounter:=1 then...
Namelabel.caption:='Image1'
Image1X:=
Image1Y:=
... main procedure...
If imagecounter:=2 then...
Namelabel.caption:='Image2'
Image2.X:=
Image3.Y:=
... main procedure...
etc.
So, my 'main procedure' occurs many times in the code, for each possible count of imagecounter.
I know i can set my 'main procedure' up as a procedure on it's own, and am happy sending variable to and from it. However, how can you have 'variable dependent variables'??
For instance, how can my seperate main procedure read in the image counter, and then modify the appropriate variables for that image without directly specifying it in a load of if.. then statements?
Can you have a 'look up' table of variable names? Can you have a variable which 'points' to the appropriate variable name?
I am sure this is just a conceptual thing in Delphi I am not fmailiar with, and i hope I have explained myself clearly.
Altough my app works great, and is only 2Mb in size, i would still like to tidy it up and optimise the code if I can.
Thanks