Specifying a dockable to display on top of stack without grabbing focus

Hello,

Does anyone know how to specify a SingleCDockable in a CGrid stacked with other SingleCDockables , to display on top but without grabbing the focus. DF current default behavior when adding dockables in the same stack group, is to display on top the last added dockable to the stack. I would like to make the first dockable that was added earlier to this stack to display on top instead of the one added last. While calling toFront() on a dockable displays it on top of the stack, unfortunately it also grabs the focus which in my specific two cases is undesirable.

Case 1: adding SingleCDockable dockables in a CGrid:
myCGrid.add(0, 0, 6, 10, homeSingleCDockable);
myCGrid.add(0, 0, 6, 10, welcomeSingleCDockable); //By default, welcomeSingleCDockable (being the last one to be added) displays on top of the stack when the CGrid is rendered initially. How can homeSingleCDockable be made to display on top instead?

Calling homeSingleCDockable.toFront() works great, but grabs the focus at the same time which is not desirable for this case.

Case 2: adding SingleCDockablePerspective dockables in a CGridPerspective:
myGridPerspective.gridAdd(0,0,6,10, homeDockPerspective);
myGridPerspective.gridAdd(0,0,6,10, welcomeDockPerspective); //By default, welcomeDockPerspective displays on top of the stack when the GridPerspective is called each time.

Please note that for some reason, toFront() did not work for me here. After loading the perspective (via load()), calling toFront() like so – ((AbstractCDockable) ((DefaultCommonDockable) dockFrontendIn.getDockable(“single homeDockID”)).getDockable()).toFront()) – still left the welcomeDockPerspective displaying on top. Is there a way to force homeDockPerspective to display on top instead?

I would appreciate any ideas. Thanks.

For CGrid you should try the “select” method, and for “CGridPerspective” the “gridSelect” method.

It’s just like calling “add” a second time:
myCGrid.select(0, 0, 6, 10, homeSingleCDockable);

If I remember correctly calling the “add” method after the “select” method will reset the properties.

About the “toFront” not working: maybe it is a multi threading issue (depends on which threads calls “load”)? Or the dockables are not yet visible? I would need a small example application to reproduce that bug.

Thank you, Beni.

gridSelect() is exactly what I needed and it’s working perfectly in all my cases.

Regarding the call ‘toFront()’ on SingleCDockablePerspective; it was part of a workaround attempt for my specific case to mimic the ‘gridSelect()’ behavior (the idea being to call ‘toFront()’, and then ‘lose’ the focus, which should produce the ‘select’ method effect). If time permits, I will try to investigate further and post back; but for now, the correct approach for my cases is to call the ‘select’ methods.

Thanks.