How do I assign a variable that only refers to an object by the state that it is in when it is referred to, for example:
dim oldPicture as picture = changingPicture
'this code changes the oldPicture and the new changingPicture but I don't want to change the oldPicture
changingPicture.Graphics.DrawLine 0,0,12,12
Here is a way which I believe will allow me to change the changingPicture object without interfering with the oldPicture object:
dim oldPicture as new picture(changingPicture.width,changingPicture.height)
oldPicture.Graphics.DrawPicture 0,0,changingPicture
'changed the changingPicture but kept the old version of the picture
changinPicture.Graphics.DrawLine 0,0,12,12
I know I got some of the parameters mixed, this is because I did not write the code in the Xojo IDE. Coming to think about it, it would be cool if you could write and execute code straight from the forums, maybe they could use xojoscript somehow.
But beneath my rambling, I probably got this wrong and my bug may lie somewhere else. I have taken a different and better approach for the bug I was stuck with. But I am just curious as to how references work. Can you change objects that you have ,for example placed in an array, without refereeing through the array but the original object you declared to go in that array. Also, how would you go about doing exactly this but not have the changes apply.
I hope you understand, THANKS