setVisible without selecting?

Hi!

Is there a way to make a CDockable visible without selecting it?

My scenario is the following:

  1. I have three tabs TabA | TabB | TabC.
  2. TabC is selected, it may have the focus or another dockable somewhere else has the focus
  3. TabA becomes invisible
  4. TabA becomes visible again (setVisible(true))
  5. Now, I see this: TabA | TabB | TabC : TabA became selected
  6. What I want is that TabA is restored in exactly the state it had before 3. so that TabC stays selected.

How to achieve this?

Thanks for your help,
Alex

I could progress like this:

dockControl.putProperty(StackDockStation.IMMUTABLE_SELECTION_INDEX, true);
// ... and don't automatically put the focus on him
dockControl.getLocationManager().getNormalMode().setShouldAutoFocus(false);

However, there is still a problem: when the new dockable is added, the current one now stays selected (IMMUTABLE_SELECT_INDEX), the new one doesn’t get the focus (setShouldAutoFocus(false)), BUT the old tab that had the focus loses the focus…

Almost there…
Alex

You can try adding a “CVetoFocusListener” to the CControl (control.addVetoFocusListener). The veto-focus-listener can stop DockingFrames from moving around the focus. You just need to remember to add the listener before making your Dockable visible, and then remove it afterwards.

That solution will not work in all cases, but let me know whether it is good enough for your use case.