$tokenlist_p1
in the dual pane version. If you use dual pane, do the same for pane 2. Write the tab IDs and substitute those numbers in the dual pane version as $tokenlist_p2
.Put the script in the script section in Configuration > Custom Event Actions for the event "Switch tabs" or, save the above script as a script file (recommended especially if using dual pane) naming it "TabChanges.xys" (or whatever and place that in the script section by adding,
load "<xyscripts>\TabChanges.xys";
Remember to set the "Action" block to Run script.If you use dual pane I recommend you use the dual pane version and save the script as a script file BECAUSE if you use dual pane we have to know when you change panes as well as change tabs. Therefore, you have to add the same script not only for CEA for "Switch tabs" but also "Switch panes". So, it makes it easier to simply add the one liner to load the script file under the CEA for "Switch panes" as you did for "Switch tabs" rather than the repeating the whole script. If the script is not placed in "Switch panes" as well, the pane change will not reflect the proper tab Nav panel condition, but instead inherits the one from the previous pane.
I know it's easy to hit the Nav Panel On / Off key, F8 or whatever you have assigned to it, but I wanted it done automatically. You could do something similar or other actions based on the "View" or something else if you wanted. Just isolate what tabs via the tab IDs. I didn't use tab indexes since those can be fiddled with based on position.
Yes, I could use a more elaborate script like Session Manager or loading layouts or similar to do this, but in this case all I really need was to show or hide the Nav Panel - simple as that.
Don, whether to show the Navigation Panel a for a particular tab may actually be a nice option built directly in to the tabs's right click menu. The script is fast but an tab specific option would be a good deal.
Thanks jupe for your comment on use with dual panes.
Use the following if you only use one pane :
Code: Select all
if(gettokenindex(tab("get","ID"), "4|5|13|18|19|22", "|", "")) { //for tabs that you don't want the Nav panel
if(get("#663")) {#663; end 1;} //if Nav panel is active, hide it
else {end 1;} //if Nav panel is not active, exit script
}
else { // for tabs that you want a Nav panel
if (!get("#663")) {#663; end 1;} // Nav Panel is not active so add it
else {end 1;} // Nav Panel is active so end script
}
Code: Select all
$tokenlist_p1 = "4|5|6|13|18|19|20|22"; // substitute your list of tabs for pane 1 here
$tokenlist_p2 = "2|4|5|7"; // substitute your list of tabs for pane 2 here
$tokenlist = (get("pane") == "1")?$tokenlist_p1:$tokenlist_p2;
if(gettokenindex(tab("get","ID"), $tokenlist, "|", "")) { //for tabs that you don't want the Nav panel
if(get("#663")) {#663; end 1;} //if Nav panel does not exist activate it
else {end 1;} //if Nav panel is not active ,exit script
}
else { // for tabs that you want a Nav panel
if (!get("#663")) {#663; end 1;} // Nav Panel is not active so add it
else {end 1;} // Nav Panel is active so end script
}