TGListBox widget placed inside a TGCanvas container with kLHintsExpandX and or kLHintsExpandY does not scale down when resizing the window (only scales up). This causes TGCanvas to show scrollbars. Here is a minimal example that demonstrates the problem: https://gist.github.com/petrstepanov/551a286cf6d15d808d0105b6b161f4be
P.S.: other widgets (tried TGLabel and TGCompositeFrame) with kLHintsExpandX kLHintsExpandY layout hints scale correctly inside TGCanvas.
Hi Bertrand. indeed TGCanvas is designed to have scrollable content inside of it. Scrollbars should appear when width or height of the canvas is less than the width/height of the child content inside it.
But if child widget’s dimensions are less or equal to the TGCanvas, scrollbars should never appear. In the example above child widget is expanded inside the Canvas container. So its width and height always equal to parent’s container. So scrollbars should never show up. Indeed, when scaling window up everything works as intended. But when scaling it down, child contents does not shrink back. Problem occurs if child widget is TGListBox. I recorded screencast that demonstrates the problem. Here is the link: https://mega.nz/#!8YlkWAbS!FdQhyaxVN5zhOoQqqm1F84HGpy9Kixy5C01xaddNe3Y
In particular, my problem is following. I’m using TGListBox as one of the child widgets inside a TGShutter. TGShutter utilizes TGCanvas to scroll content inside its TGShutterItem’s. So same issue is observed here (see screencast https://mega.nz/#!gM92nQjD!MYHckfUINl_mMdTYE98dfZl5DuZ_SRMGZpwagK0a6TI). The original Gist example just narrows the problem down to a minimal piece of code.
Thanks for pointing out the workaround. Do you think its reasonable to repost the issue to Jira? From my perspective this should work correctly “out of the box”.
You’re welcome, and no, it would be useless to open a Jira ticket because it’s a conceptual issue, and it cannot be solved in any reasonable way…
This is a little frustrating of course. Especially when implementing conventional MVC/MVP patterns to design the UI. Child widget can be a part of on View, that has no clue about the parent View at all. Then implementing this signal/slot workarounds is considered sort of a hack.
At the same time I totally understand that it can require a lot of efforts to fix “conceptual issues” like this. Thanks for your help Bertrand!