Forum Discussion
alinder
14 years agoContributor
What your code is trying to do is not just set X= H, where H is the cancel button or any other of the objects. It is trying to set X=A.B.C.E.F.G.H
If A doesn't exist, it can't have child B. If B doesn't exist, it can't have child C, and so on.
You can't expect the software to handle the instruction "These are all the objects I care about" up front because you don't have all those objects to give it.
What you want to instruct is "Here is how you will get all the objects I care about," and then later during execution have it give you those objects based on the criteria you specify.
You could store what you have as long strings, and when you need an object do an Execute commands to get it- though I wouldn't recommend it for stability.
You could store an array of properties and values, and do a Find() with those when you need an object.
Or you could re-implement your own version of name mapping, and every time you need an object call a function that takes a dot-separated string and returns an object, and put all your code into something that will iteratively parse that string if the object exists based upon your defined properties, and return a non-existent object if not.
You could take the block of initialization code you have now and call it every time you need an object or change screens, instead of just once at the beginning.
If A doesn't exist, it can't have child B. If B doesn't exist, it can't have child C, and so on.
You can't expect the software to handle the instruction "These are all the objects I care about" up front because you don't have all those objects to give it.
What you want to instruct is "Here is how you will get all the objects I care about," and then later during execution have it give you those objects based on the criteria you specify.
You could store what you have as long strings, and when you need an object do an Execute commands to get it- though I wouldn't recommend it for stability.
You could store an array of properties and values, and do a Find() with those when you need an object.
Or you could re-implement your own version of name mapping, and every time you need an object call a function that takes a dot-separated string and returns an object, and put all your code into something that will iteratively parse that string if the object exists based upon your defined properties, and return a non-existent object if not.
You could take the block of initialization code you have now and call it every time you need an object or change screens, instead of just once at the beginning.