[haiku-3rdparty-dev] Re: Layouting question

  • From: Brian Hill <perelandra777@xxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Wed, 27 Apr 2016 14:53:18 -0400

Humdinger,
I feel your pain, I spent lots of time trying to get layouts working just
right with Einsteinium.  Don’t try using a scrollview, it just does not
look right.  I thought of that too and tried it :-)  There is a solution to
your problem.  As mentioned by John, try removing some glue.  Also the
function SetExplicitMinSize may help with preventing the window from
getting too small for the TextView.
See how I did just a TextView (no buttons) here:
https://sourceforge.net/p/esforhaiku/code/HEAD/tree/trunk/src/Preferences/LauncherAboutView.cpp

But in one case where I did have a textview and a button I also could not
get the layout engines to do what I wanted, so I got rid of them and just
did layout resizing manually.  See here:
https://sourceforge.net/p/esforhaiku/code/HEAD/tree/trunk/src/Preferences/EngineMaintenanceView.cpp

The commented out parts in the constructor are what I was trying to do with
layouts that just wasn’t working.  So I went back to just using AddChild
and then created a custom
EngineMaintenanceView::FrameResized(float width, float height) function
that calculated positions to resize and move the textview and button where
I wanted.

Remember though this was all 5 years ago so there may be changes to the
layout builders that make them smarter now.

-Brian

On Wed, Apr 27, 2016 at 10:30 AM, Humdinger <dmarc-noreply@xxxxxxxxxxxxx>
wrote:

Hi!

On 26 April 2016 at 23:03, John Scipione <jscipione@xxxxxxxxx> wrote:
If you AddGlue() between your two vertical groups it will push them
left and right respectively, but that's probably not what you want.
You want the left vertical group to stay put and the right vertical
group to grow.

Exactly. As I wrote... :)

I see that you have overridden MinSize() and MaxSize() of IconView to
64x64. That should keep it from growing

Yes. The view itself stays at 64x64. Resizing the window horizontally
moves it to the right though.

Is the fInfo text view not growing when you resize?

It is growing alright. But also moving along like the icon view.

You could try putting the BTextView inside a BScrollView and see if
that works better for you.

That seems to take care of the buttons being swallowed on vertical
resizes, but has its own issues: it only shows the BTextView's first
line.

Remove the last AddGlue() in your horizontal group to make the buttons
flush right.

No, the glue is OK. I like those buttons centered under the fInfo view.

I can vertically resize the window to
cut off the buttons below and a part of the BTextView:
https://lut.im/loe358An12/3e7wMzpzDTuDceND.png

That is expected. Set the minimum height on the window to prevent that
from happening.

How's that supposed to be done? I can set a window size on
construction of the BWindow, but that doesn't tell the window its
min/max sizes. I'd excpected the layout management taking care of
that. Seems the BTextView doesn't inform about it's actual vertical
size.

I'll be trying a grid layout now, see if that works better.
If anyone has other ideas...
Thanks!

Regards,
Humdinger

--
Did you know:
  If half the Haiku supporters at http://www.goodsearch.com
  made 10 searches a day, we could have a fulltime developer.


Other related posts: