On Fri, 20 Mar 2015 12:21:57 +0000 Henry Vermaak <[email protected]> wrote:
> On Fri, Mar 20, 2015 at 12:57:47PM +0100, Mattias Gaertner wrote: > > On Fri, 20 Mar 2015 11:31:07 +0000 > > Henry Vermaak <[email protected]> wrote: > > > > >[...] > > > > The gtk2 interface only knows the current size of the child > > > > control(s). It does not know the preferred size of the child control(s). > > > > > > So how do we fix this? If the groupbox code is changed so that it only > > > evaluates its own minimum size, will the autosize code do the rest, i.e. > > > loop over the children and take the maximum width/height? > > > > The LCL takes care of the child sizes. > > OK, so then the use of GetGTKDefaultWidgetSize() in the groupbox is > wrong, since that's what is looping through all the child controls. > I've attached a patch that works for me, it's basically cribbed from > GetGTKDefaultWidgetSize(), so maybe that needs a NoChildren parameter so > that we don't duplicate the gtk2 size request code. gtk_widget_set_size_request computes the gtk2 idea of the size of the widget including all child widgets. This includes widgets of the LCL child controls. TGtk2WSCustomGroupBox.GetPreferredSize should ignore the LCL child controls. It should return the size, as if there are no LCL child controls. The LCL computes the needed client area and adds the frame. The final preferred size is the maximum of these two sizes. I added a comment to TGtk2WSCustomGroupBox.GetPreferredSize. Mattias -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
