2 Replies Latest reply on Jun 15, 2007 9:32 AM by TucsonJava

    When does it exist?

      I call a web service in one state, the result event of that web service call happens to set the selectedIndex of a combo box in another state - a state that the user has not navigated to. I receive a message that I have referenced a null object (the combo box). The code "appears" to work if the user has previously entered the second state prior to the result event firing. Am I correct to assume that the combo box in the second state does not really exist because the user has not naviated to it -- currentState = "secondstate"? If so, is there a way to initialize the state in some way so that the combo box is not null (without actually setting the currentstate? Also, is there any documentation that describes the process of how all objects in an app get created and when?
        • 1. Re: When does it exist?
          I had the same problem a few weeks ago and never got it working. I don't think the comboBox in the second state is initialised until it is viewed. I had to use two seperate components instead of two states.
          I'd be interested to see if anyone has a full explanation of whats happening exactly?
          • 2. Re: When does it exist?
            TucsonJava Level 1
            Here's what I do in that situation. In the initialization method, I set the currentState to one of the states in the component, do any initialization of the components of that state, then move to the next state, etc. Finally, set the currentState to be whatever you want the component to end up in.

            This way all the component of each state are initialized and ready for action no matter what state you start in. If there's a better way to do this, I'd like to know too.