I have used two tier navigation in the same way as described in the link below: first tab strip window nav disabled, secondary tab strips become visible based of the primary selection. My secondary tab strips then use swap window method.
This all works fine, apart from I was wondering how I could go about resetting the secondary tab strips so that they return back to the first selected tab when becoming visible, and swap to the relevant first window again?
They key to the currently open window. You would have to script the outer tab strip to immediately navigate to the first window of the inner strip when activated.
I add a custom column to the tier 1 tab data that holds the window path for the first window in the secondary tab strip associated with that primary tab.
def tier1MouseClicked(tabStrip, selectedTab = None):
'''
Swap window from the docked 1st tier navigation tab. 1st tier tabStrip must include "Tier2" column with path to the main window.
Args:
tabStrip (Tab Strip obj) : 1st tier tab strip object. (event.source)
Must include custom "Tier2" column in tabData dataset
seledctedTab (INT) : Selected first tier tab. (optional, default uses tabStrip.selectedTab)
(0-based index for tabData dataset)
Returns:
n/a
'''
#selected tab not specified, use selectedTab prop on tab strip
if selectedTab is None:
selectedTab = tabStrip.selectedTab
#get window path
tier1 = int(selectedTab)
windowPath = tabStrip.tabData.getValueAt(tier1,'Tier2')
#swap to window and update props
contextNavButtonClicked(tier1, windowPath)
def contextNavButtonClicked(tier1, windowPath):
'''
Swap windows from a context navigation button.
Args:
tier1 (string) : 0-based index for tier 1 tab strip
windowPath (string) : window to swap to
Returns:
n/a
*Nav.Root Container.currentWindow (string) : update navigation docked view current window
*Nav.Root Container.currentTier1 (string) : update navigation docked view tier 1 tab
'''
#swap to window
system.nav.swapTo(windowPath)
#update tier 1 and tier 2 props
dockedNavRootContainer = system.gui.getWindow(dockedNavPath).getComponentForPath('Root Container')
dockedNavRootContainer.currentTier1 = tier1
dockedNavRootContainer.currentWindow = windowPath
There are some other non-standard custom properties in these scripts, but hopefully these can give you an idea.