[haiku-development] Re: Putting a BGridView inside BScrollView

  • From: Michael Pfeiffer <michael.w.pfeiffer@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 14 Nov 2010 18:16:47 +0100

Am 14.11.2010 um 13:08 schrieb Ingo Weinhold:

> 
> On 2010-11-14 at 12:19:10 [+0100], Michael Pfeiffer 
> <michael.w.pfeiffer@xxxxxxxxx> wrote:
>> In the code inside the comment:
>> http://dev.haiku-os.org/browser/haiku/trunk/src/libs/print/libprint/JobSetupDlg.cpp?rev=39423#L370
>> I want to put a BGridView inside a BScrollView using the Layout API.
>> However when the window is displayed, the parent view containing the
>> BScrollView still has the size of the BGridView, and the BScrollView
>> is vertically centered inside the parent view.
>> 
>> Parent view:
>> +------+
>> |      |
>> |+----+|
>> ||    || <- BScrollView
>> |+----+|
>> |      |
>> +------+
>> 
>> BTW in the code the parent view is a BBox.
>> 
>> Any ideas what I do wrong and how to solve the problem?
> 
> I wouldn't rule out that there are still bugs related to BScrollView, but 
> from your description I'd say that the grid view has a maximum size limit 
> that forces a maximum size limit on the scroll view. So what you're seeing is 
> the scroll view having hit is maximum size and its parent view having no 
> other choice than to center it in the available space.

> You should check what is causing the grid view's maximum size limit and try 
> to remedy that, e.g. by adding glue. If that's not desirable for some reason 
> you could override the maximum size limit on the grid view or on the scroll 
> view (with different results). Setting an explicit alignment of 
> B_ALIGN_USE_FULL_{WIDTH,HEIGHT} on the scroll view is yet another option. The 
> size limit will still be propagated to the parent view, but the scroll view 
> will use all space that is available (instead of being centered in it).


The window looks like this (PV = parent view, SV = scroll view),
in the left "pane" is the parent view and the right "pane" contains
another view:
+--------------------+
|+------++----------+|
||PV    ||          ||
||+----+|+----------+|
|||SV  ||            |
||+----+|            |
||      |            |
|+------+            |
+--------------------+

So the parent view shouldn't be so tall. It somehow takes the height of
the grid view as its height. The window uses the flag B_AUTO_UPDATE_SIZE_LIMITS.

I have now tried to set the "explicit max size" to various combinations
to the scroll view, the grid view and the parent view without successful
result.
The height of the left "pane" with the parent view is always too tall.
And still its height depends on the contents of the grid view.

Without using the scroll view the window looks like this:
+--------------------+
|+------++----------+|
||PV    ||          ||
||      |+----------+|
||      |            |
||      |            |
||      |            |
|+------+            |
+--------------------+
That is what I would expect. But since the grid view gets so large
the window does not even fit on the screen, that's why the use
of a scroll view.

BTW if anybody wants to reproduce the problem, you can
remove the line (369) above the comment in JobSetupDlg.cpp
and enable the code in the comment:
http://dev.haiku-os.org/browser/haiku/trunk/src/libs/print/libprint/JobSetupDlg.cpp?rev=39423#L369
and in GPParameterVisitor.cpp line 129 set kMaxLevel to 
STP_PARAMETER_LEVEL_ADVANCED4
http://dev.haiku-os.org/browser/haiku/trunk/src/add-ons/print/drivers/gutenprint/GPParameterVisitor.cpp?rev=39423#L128
and add a printer (driver: Gutenprint; manufacturer EPSON; model C50; 
transport: Print to File) with Printers preflet
and print with StyledEdit. The Job Setup Dialog height will be too tall.

Bye,
Michael


Other related posts: