How do I determine the current tab selected on a panel when it is (re)activated?

I am trying to do something akin to this ...

Function CreateMyPanel()
   
    // panel frame
    NewPanel/W=(0,0,100,100)/N=MyPanel as "My Panel"
    SetWindow MyPanel hook(mPH)=myPanelHook
    ...

    // set up four different tabs
    // use a TabProcedure to control them
    ...

    return 0

end

Function myPanelHook(ipH)       // WindowHookFunction
    STRUCT WMWinHookStruct &ipH
   
    variable hookResult = 0, tn
   
    switch(ipH.eventCode)
        case 0:
            ControlInfo/W=MyPanel TabControl
            tn = V_value
// --> set debugger at this point
            print "active at tab", tn
             ...
    endswitch
    return hookResult

end

What this _should_ do is to print the currently active tab when the panel window is re-activated. It does not. In the debugger, at the point marked // --> set debugger at this point, I see v_flag = 0 (it should be 3), and v_value = 0 regardless of tab selected (it should be 0 - 3 depending on the tab selected).

I have a TabProcedure that runs when the tab is switched. The TabProcedure prints the tab number properly when the tab is switched while the panel is active. For example ...

  initializing tab   2

So, tab 2 is initialized, I move off to a different window (the Browser), move back to the Panel, and get 

  active at tab  0
??? What am I missing here ???

Do I have to pay attention within the hook function to something else to have the ControlInfo call work properly?

Igor 7.09B01 on macOS 10.13.6

 

Never mind. I used the generic term 'TabControl' when I should have written this ...

ControlInfo/W=MyPanel main

... where 'main' is the name of the main tabcontrol.