[Lazarus] GroupBox AutoSize issues
nc-gaertnma at netcologne.de
Fri Mar 20 16:23:44 CET 2015
On Fri, 20 Mar 2015 12:21:57 +0000
Henry Vermaak <henry.vermaak at gmail.com> 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 <henry.vermaak at gmail.com> 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
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.
More information about the Lazarus