Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Closing all windows under a tabGroup - need help

I am using tabGroup as my app's main navigation. In tabGroup(0) I have a process that goes about 5 windows deep. Is there a programmatic way to close all windows in tabGroup(0) and return to the start of tabGroup(0) without using the back button on each window?

Thank you in advance for answers.

— asked November 28th 2010 by Michael Updegraff
  • navigation
  • tabgroup
  • window
0 Comments

2 Answers

  • Accepted Answer

    if you keep an array of windows as you add them to the tab, then you can fire an event that loops through the array and closes all the windows

    — answered November 28th 2010 by Aaron Saunders
    permalink
    4 Comments
    • @aaron - would the array need to be passed to each new window within the tabGroup or is there a way to make it global and push items into it?

      — commented November 28th 2010 by Michael Updegraff
    • you can set up an custom event to add the items to the array.. something like this.

      Titanium.API.addEventListener( "UPDATE_WINDOW_ARRAY",  function(win) {
          myWindowArray.push(win);
      });
      

      — commented November 28th 2010 by Aaron Saunders
    • no way to edit comments… but I dont think you can pass a window object in an event… trying to validate now

      — commented November 28th 2010 by Aaron Saunders
    • I'm trying to do the same thing as Michael. Aaron, have you validated whether or not you can pass a window object in an event?

      — commented October 31st 2012 by Aaron Sumsky
  • Michael

    Have a look at custom events. You would need to define one for each window that you would like to close from another context. Note that it would probably be wise to close them in the order that they were opened, but you would have to experiment to find out what works best.

    Cheers

    — answered November 28th 2010 by Paul Dowsett
    permalink
    1 Comment
    • Thank you @Hal - I'm looking at the link now.

      — commented November 28th 2010 by Michael Updegraff
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.