setVisible

I am experimenting with CDockable.setVisible(boolean). A dockable is visible after adding it to its CControl and calling setVisible(true), of course.

If I then call setVisible(false) it appears the dockable is also removed from its CControl, since a subsequent calls to setVisible give the message
This CDockable does not know its CControl…

I’m sure there is a good reason for this - just that my understanding is not yet adequate - could I have a quick explanation?

Thanks

Are you experimenting with a DefaultMultipleCDockable? These Dockables are often used as editors (e.g. a textfield showing some file), making them invisible also removes them from the CControl. This prevents applications from adding Dockables and then forgetting them (thus creating a memory leak). You can change the behavior by calling “DefaultMultipleCDockable.setRemoveOnClose( false )”.

Meh - stupid question, sorry.

Yes they are DefaultMultipleCDockable. Not sure how I missed that. Thanks