TabProc to hide graphs?

I've written before about a 3 tabbed panel I use and challenges with modifying it. The panel control proc, "TabProc", uses ControlNameList("") to gather all the controls together. It does not seem to include the graphs or tables embedded in the panel. I would like to add a blanking feature to graphs which display on the panel. If tab0 or tab1 is choosen blank out the graph, else display it.

Is there a more detailed guide to the ControlNameList and how one uses it with panel Control procs?

---------


Function TabProc(ctrlName,tabNum) : TabControl
String ctrlName
Variable tabNum

String curTabMatch= "*_tab"+num2istr(tabNum)

String controls= ControlNameList("")
Variable i, n= ItemsInList(controls)
for(i=0; i String control= StringFromList(i, controls)
Variable isInATab= stringmatch(control,"*_tab*")
if( isInATab )
Variable show= stringmatch(control,curTabMatch)
ControlInfo $control // gets V_disable
if( show )
V_disable= V_disable & ~0x1 // clear the hide bit
else
V_disable= V_disable | 0x1 // set the hide bit
endif
ModifyControl $control disable=V_disable
endif
endfor
return 0
End
Graphs and tables are not controls, so they won't be included in the list returned by ControlNameList(). You need to use

SetWindow subwindowname hide=1

where you need to replace "subwindowname" with a complete subwindow path and name.

I recommend using the structure-based control action procedures. They are getting the attention in future development, they are faster and more reliable, and the structure passed to your action procedure includes the name of the window containing the control.

I also recommend using the window name in places like the call to ControlNameList(). Odd and hard-to-find bugs result from action procedures that due to unforeseen circumstances wind up running with the top window not being the window that originally triggered the call.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
I added an If / else / endif with the setwindow xxx#G3, hide = 1 etc etc statements inside the tabcontrol proc.

That seems to fix it.

Thanks