Titanium Community Questions & Answer Archive

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

Load initial window that is not a tab, with the tab bar showing

I am using a typical app.js file, with 4 windows assigned to 4 tabs.

I'd like to have the initial window that loads load in the main window (With the current nav AND tab bar), but NOT have a tab for this initial window.

In other words, my first window should have a nav and tab bar, but not a tab. (I have a navigation button that allows users to get back to the initial page.)

I could easily have the initial page load if I simply added another tab with the window, and had it be the first tab, but how do I do this without assigning a tab. (I'm not including code, as my app.js file looks exactly like the default app that is created when you setup a new project.)

I'm loving the community and so appreciate the help I've received here so far.

Thanks,

Peter Janett

— asked July 16th 2010 by Peter janett
  • bar
  • inital
  • tab
  • window
0 Comments

2 Answers

  • The classical tabbed app needs to do at the end of app.js someting like:

    tabgroup.open()

    to start.

    What if you try something like this, instead of this last line ?

    
    
    var no_tab_win =Titanium.UI.createWindow({.....});
    
    tabgroup.open();
    
    Titanium.UI.currentTab.open( no_tab_win ) ;
    
    — answered July 16th 2010 by Dan Tamas
    permalink
    0 Comments
  • I managed to get this working, and wanted to share what ended up working..

    What I ran into is that I could active the tab I wanted the new url to show in easily, with
    tabGroup.setActiveTab(tabGroup.tabs[4]);
    Where the 4th tab was the tab I wanted to target.

    The trick was to THEN have that webview in that tab load the new URL. I ended up having to set a "global" string with the new url:
    Ti.App.Properties.setString('new_url', include_url);

    Then, I added an event listener to the window that was tied to the tab, so that the url would update when the tab became in focus. That made the url load (and reload) ANYTIME that tab had focus. So, I added an if statement so that the URL would only update if the global variable was set, and after updating the url, I unset the global variable…

    Here's the code, starting with the "link" in a table view in another tab:

    include_url = songs[e.source.row].buyalbum;
    Ti.App.Properties.setString('new_url', include_url);
    tabGroup.setActiveTab(tabGroup.tabs[4]);
    

    Then, in the target window, which is tied to tab[4]:

        if(Ti.App.Properties.getString("new_url")){
            webview.url = Ti.App.Properties.getString("new_url");
            Titanium.App.Properties.removeProperty("new_url");
       }
    

    It took me a long time to figure this out, so I'm posting it hoping it will help someone else out..

    Thanks again to everyone participating!

    Peter Janett

    — answered July 23rd 2010 by Peter janett
    permalink
    0 Comments
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.