2 Replies Latest reply on Aug 6, 2007 5:57 AM by Cheree Singal

    Tab Navigator problem

    Cheree Singal
      Hi,

      I am adding children to tab navigator dynamically . Now this is the problem that I am facing.

      I have a list of tabs from which the user can choose for the tabs that he wants to add to the tab navigator.
      Suppose the list is:

      Child 1
      Child 2
      Child 3
      Child 4

      Now, to begin with user selects Child 1 & Child 2.

      In the tab Navigator he selects 2nd tab, i.e., Child 2.

      Now, he goes back to the list and selects Child 3 & Child 4.

      In the code, I am doing:
      tabNavigator.removeAllChildren();
      tabNavigator.addChild(Child 3);
      tabNavigator.addChild(Child 4);
      tabNavigator.selectedIndex = 0;

      The surprising thing is that now in tab navigator, the contents of selected tab are those of Child 3 but the name is shown as Child 4. Then when I click on Child 3, then the selected name shows correctly.

      Can anyone suggest a work-around for this or is there something that I am missing?

      Thanks,
      Cheree
        • 1. Re: Tab Navigator problem
          ntsiii Level 3
          This may be a timing issue (just brainstorming). Try removing the children, then use callLater() to add the new children.

          Tracy
          • 2. Re: Tab Navigator problem
            Cheree Singal Level 1
            Hi Tracy,
            Thanks for replying:) I am sorry for acknowledging so late. I tried the above method but it gives rise to another problem. I am calling a method when any of the tabs in the tab navigator is clicked for the first time. After using callLater() that method is not called for the first time the tabs are visited. However if I visit the tabs the second time, it gets called! So, may be I need something else.

            Thanks,
            Cheree