I came up against this recently. If you are using C# with Ninja you might (like me) be opening new windows from Ninja charts.
Trouble is - when the user switches workspace, there is no supported way to detect if they have switched and so no way to hide your own window when the user switches workspace and hides all the windows in their workspace.
So - despite the fact that this will be useless to 99.999% of people. I will share how to do it.
So - without further ado (drumroll please...) I shall reveal the complexities of the method of resolving this issue which according to the Ninja Support Forum is not possible.
if (ChartControl.CanFocus == false)
Yup - that's all you need to do. Stick it in onBarUpdate, create a custom event or whatever you need to do. If this property is false, it means the associated chart is not available because it is on a workspace that is not current.
Just a matter of digging around. Although not supported, I can't see how this feature will ever stop working.