SA Project - How to create a more dynamic Tabbar menu with faceplates

Hi

I have a project with a tabbar menu(The Default InformationZone one with Alarms, Trends). I am trying to add additional tabs that is based on the equipment selected to the tabbar.I have managed to do this using the TabBar_AddTab function and i have gotten dynamic tabs added. This works fine but the added tabs are still there after changing the equipment selected since the menu doesnt refresh.(The reason i want this is so that i can tie several FP pages (Control, Settings, Runtime etc) to one equipment)

I have scavenged the cicode for a function to refresh the tabbar, i have tried changing the page(workspace connection was lost), running the oninit function. There is probably an easy way but SA is too new for me so i have a hard time understanding how everything is tied together yet.

What i am looking for is quite simple, a function that resets the tabbar when a new equipment is selected. Anyone done something like this?

(A Dynamic tabbar menu example would also be relevant for me here)

Any help appreciated!!!!