Resizing with TGCanvas

Hello!

In my GUI, I’ve used TGCanvas so that I’ll have scrollbars in my window. I also want the frames to expand and retract if I manually widen or lengthen the window. I’ve added the layout hints kLHintsExpandX and kLHintsExpandY when I add the frames and the frames do expand properly, but they don’t retract which doesn’t make sense to me.

I’ve attached a macro showing what I prefer not to happen. When I open the GUI, I can manually change the window size just to the point where the scrollbars disappear. I’m going to call this the default size. Then, I can also make the window bigger and the frames expand accordingly. Now, after making the window bigger than default size, if I try to make the window smaller, the scrollbars automatically appear instead of waiting to shrink back to the default size. I’m assuming this happens because the frames do not shrink? I was expecting them to shrink because of the layout hints, but I’m guessing there is something I’m missing. Any help is appreciated. Thank you! If anything doesn’t make sense, please let me know.
test_window_resize.c (2.51 KB)

Hi,

There is a conceptual issue here. the TGCanvas allow to have scroll bars when down-sizing a window containing fixed size frames (like in the editors). But if the sub-frames have a expand X/Y layout flag, then when should they be re-sized, and when not (i.e. when the scroll-bars will appear/disappear)? The behavior you see is the way it should be…
EDIT: To see what I mean, just try the following:

TGHorizontalFrame* hMain = new TGHorizontalFrame(fGCanvas->GetViewPort(), 500, 400, kHorizontalFrame | kFixedWidth); And see the difference of behavior between width and height when re-sizing the main frame…

Cheers, Bertrand.

Hi Bertrand,

OK, thank you for clarifying that. It makes sense I think.

Thanks!