Have a play around with the OnPanelSwitch script trigger. You will have to give each panel an Object Name I think, but should be able to get what you want in there somewhere.
Yes, you will need to give each panel an object name. This is not the name you provide in tab control set up as a tab label but what you enter into the Name box in the Inspector after selecting a specific tab in your tab control.
Then you'll need to use the Get ( TriggerTargetPanel ) to get the info on the panel that becomes current after OnPanelSwitch is tripped when the user changes tab panels. Look this function up as it provides a list with two items of info--the number of the panel and the object name. You can use GetValue to extract the object name and store it into a $$Variable.