Resize TGMainFrame when undocking TGDockableFrame

Hello,

I have a gui in which in addition to other widgets, a TGDockableFrame is the parent of a TRootEmbeddedCanvas. When I try to undock the TGDockableFrame, the top TGMainFrame of my application does not resize accordingly (it does not shrink the amount of space the TGDockableFrame was taking, on the opposite as when one undocks a TGPopupMenu). I even tried to resize explicitely using the SetHeight method without success…

I must be missing something obvious, so any help is greatly appreciated !!

Regards,
Sergio

Hi,

Could you post a short running macro showing the problem?
Did you try to call the Layout() and/or Resize() methods of your main frame?

Cheers, Bertrand.

Hi Bertrand,

thanks for your advise !! The Layout() method helped, but still I am not getting the effect I am looking for…

Please check the example attached. I would like to undock the frame containing the canvas (actually it’s a slightly more complicated frame) and the main window resizing accordingly, just leaving the menu and status-bars (without empty space below).

If I resize the undocked frame and then re-dock it, I also would like of course the main window to resize accordingly (to account for any size variations)…

Thanks for the help.

Cheers,
Sergio
dock.C (5.69 KB)

Hi Sergio,

Could you try the following:

[code]void MyFrame::Undocked(){
cout << "UNDOCKED " << endl;
Resize(GetDefaultSize());
Layout();
}

void MyFrame::Docked(){
cout << "DOCKED " << endl;
Resize(GetDefaultSize());
Layout();
}
[/code]
Cheers, Bertrand.

Hi Bertrand,

thanks, it works nicely just after undocking.

However, if I dock the TGDockableFrame again (and after resizing it), how do I tell the main frame to account for the new TGDockableFrame dimensions ?

Cheers,
Sergio

Well, I think there is no easy way… It will keep the original (before the undocking) size. If I find a solution, I’ll keep you in touch.
Cheers, Bertrand.

Hi Sergio,

You can try the attached macro (which is a slightly modified version of the one you posted). It is not a perfect solution, but it shows what can be done…

Cheers, Bertrand.
dock2.C (6.18 KB)

Dear Bertrand,

that is just brilliant !!! It works like a charm =D> =D>

Thanks a lot for your the quick responses and time spent looking into this.

Regards,
Sergio

Hi Sergio,

You’re welcome! Glad to know it helps!

Cheers, Bertrand.

Hi all,

sorry for re-opening this thread again… Related with this same example file attached before, I have another minor issue I do not manage to solve.

I have the constraint that my application needs to be cross-platform. The whole gui is correctly displayed in Linux SLC5 and MacOS 10.5.8, but after trying running in WindowsXP with ROOT 5.26.00, it appears that both the lower TRootEmbeddedCanvas and the TGTextView are not visible at all, i.e, everything below the TGHSplitter.

Again, any advice would be more than welcome.

Thanks in advance and cheers,
Sergio

Hi Sergio,

This sounds weird, since I’m mainly developing on Windows, and I have no problem with the dock2.C macro running with the svn trunk version of Root. Anyway, I’ll check with 5.26.00 and let you know.

Cheers, Bertrand.