I came up with something that may not be very elegant, but it solves my problem, at least:
First, assume I have a fixed set of tabs I use all the time, and wish to have them either all showing, or all hidden. Second, assume I do not use autohide (I want to control the tab window).
Here's the code:
static _str my_active_tab[];
static _str my_active_ctrl[];
static int my_active_tab_id;
static int my_max_tab;
static int my_search_tab_idx;
_command toggle_lower_window() name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
cursor_data();
int w0 = _tbIsVisible(my_active_tab[0]);
if (w0)
{
boolean found = false;
int j;
int af = _tbTabGroupWidFromWid(w0)._tabgroupFindActiveForm(-1);
for (j = 0; j < my_max_tab; ++j)
{
wid = _tbIsVisible(my_active_tab[j]);
if (wid == af)
{
my_active_tab_id = j;
found = true;
break;
}
}
if (! found)
my_active_tab_id = 0;
toggle_refs();
}
else
{
my_active_ctrl[my_search_tab_idx] = _get_active_grep_view(); // just in case
toggle_refs();
activate_toolbar(my_active_tab[my_active_tab_id], my_active_ctrl[my_active_tab_id]);
}
cursor_data();
}
//******************************************************************************************
definit()
{
my_active_tab_id = 0;
my_active_tab[0] = '_tbtagrefs_form';
my_active_ctrl[0] = 'ctlrefname';
my_active_tab[1] = '_tbtagwin_form';
my_active_ctrl[1] = 'ctltaglist';
my_active_tab[2] = '_tbsearch_form';
my_active_ctrl[2] = _get_active_grep_view();
my_search_tab_idx = 2;
my_active_tab[3] = '_tbshell_form';
my_active_ctrl[3] = '_shellEditor';
my_active_tab[4] = '_tbbookmarks_form';
my_active_ctrl[4] = 'ctl_bookmarks_tree';
my_active_tab[5] = '_tboutputwin_form';
my_active_ctrl[5] = 'ctloutput';
my_max_tab = 6;
}
If you don't see your favorite tab, go to tbcmds.e in the program Macros directory, and you will be able to find the strings for the tab names/controls you want. Note that names/tabs are subject to future change by SE.
By binding toggle_lower_window() to a key, I get a "toggle" of the entire tab bar--with the bonus of it "remembering" which tab was last active. (The refs window is the default if anything goes wrong.)
This obviously needs value checking, etc. Also, a more elegant solution would be to first enumerate all the tab windows and their controls that are present (instead of assuming them with an array at init time).
It works for me, though.
Chuck