Close currently active dockable

I want to know which is the currently active dockable so I can e.g. write an action to close the currently active dockable. For that I would add a CControlListener to the CControl and remember the dockables in the order they were opened. Then I would close the last opened dockable.

Is this the right way to do that?

I saw that there are methods in the DockFrontend to hide dockables. But I want to first find out which is the currently active dockable so I can hide it.

Is there any method to find out which dockable has the focus/is currently active?

greetz
– M

You could add a CFocusListener to your CControl. The listener is called whenever the focused CDockable changes.

Another approach would be to call “getFocusedDockable” of “DockController”, but that will return a Dockable, not a CDockable.

Can I also listen for size changes of a dockable? I have tried the CDockableStateListener and the CDockablePropertyListener but they don’t provide something like a “sizeChanged()”-method.
Thanks,
grml

Just add a ComponentListener to the Panel/Container onto which you have put your stuff (buttons, textboxes, etc.) and which you handed over to the Dockable.