In my program, i have an image, 2 edit boxes and a button. In the edit boxes, i input an X value, and a Y value. Upon clicking the button, the image will slowly move from its current position, to the new position, as determined by the X and Y values entered into my edit boxes.
My function to move the image works fine, however i now wish to use this function to be able to move different images. Is it possible to tell my function which image to move, by entering the name of the image into an edit box? For example, lets say i have 2 images on my form, named image1 and image2 respectively. I now enter the X and Y values into my edit boxes, and into a third edit box, i enter 'image2'. When i click the button, i need the function to move the image named 'image2' to the new coordinates. If i were to enter 'image1' into the third edit box, the function would have to move the image named 'image1' to the new coordinates.
I am looking for a solution, so that i can remove all bits of code from my function that specifically refers to an image. For example, i cannot use image1.left:=image1.left+3, as the function may be used to move image1 or image2.
To make it clear what i am looking for, i have written very brief psuedo code below.
x:=edit3.text (where x refers to an image)
so in my pseudo code, if edit3.text was 'image2' then the second line of my pseudo code would in effect read image2.left:=image2.left+3.
Is this at all possible to achieve?
Any help appreciated.
Tried to make this question as clear as i can. please say if you dont fully understand.