Close and focus

Hi!

I need to add logic when a Dockable (that is on workingarea - if that matters) get focus and when it is beening closed - how can i add my logic when this events happening.

and another thing - I need to set focus in the code - on a Dockable - how can do that?

thanks!

Focus: add a CFocusListener to a CDockable to receive an event when focus is gained or lost. Call the method “toFront” on any subclass of AbstractCDockable to make the element focused (this will not work if the element is invisible).

Closing: add a CDockableStateListener to a CDockable. When the element is made invisible (=closed) its “visibilityChanged” method will be called.

I’ve tried with this approach (adding focus listener to the dockable). One issue I’m facing is that the focusGained() is not getting fired in some cases, Consider this scenario where I’ve a CWorkingArea with multiple opened MultipleCDockables.

Whenever I open or create a new MultipleCDockable then the corresponding focusGained() is getting fired, but when I close the MultipleCDockable using titlebar’s close icon then the next available MultipleCDockable’s focusGained() is NOT getting fired because it’s not focusing that! (I checked this with Eclipse and Flat themes, if you can’t simulate first try to focus out of this working area and try closing the close icon of this dockable and see if the next available dock will get the focus)

My intention is to track the currently shown (not necessarily focused) dockable of the CWorkingArea. Previously you’ve mentioned that CWorkingArea is designed to show multiple dockables at the same time. But in my case I’m showing only one editor window (dockable) in the working area (like in Paint app.). Instead if I ask the framework for the currently focused dockable, it might give me currently focused dockable, which could be another dockable which is not part of CWorkingArea, like Explorer dockable (of paint app). Please help me out.

Sounds like a bug to me, the event should always be fired. I’ll answer as soon as I found out what is going wrong.

Looks like this is no longer a problem in 1.0.8p3, when I reported the above focus issues I realized that I was using p2.

Thanks.

Ok, I’ll check it anyway since I don’t remember fixing this (but then I worked on p3 quite some time…)