I know this not a developer forum, but I try it anyway.
How does the layout engine determine the size of a Bview/BBox?
Current scenario (also visible as trac bug in Translator Preferences for PNG/JPG). I get a BView (classic one, without layout). The view is shown in a BBox, integrated in a window with Group Layout.
Thing is, the window displays the content always cut off to the right, but clicking inside the view enables you to scroll and read the rest of the text.
The size (height/width) which I can get from the view for Min/Max and Preferred is always too small (for the height at least the max value is big enough ) for the complete content, so setting the explicit min size to the max values does not work.
So how can I determine the correct size of a view and why does the Layoutmanager also fail at this task?
The system is not designed to mix layout and non-layout views. Both use different way of specifying and computing size constrains (GetPreferredSize for the old way vs SetExplicitMin/Max/PreferredSize for layout-enabled ones)
For a layouted view, the BLayout just ask each children for its size constraints, and computes its own size by adding this plus any padding/insets. But when a view does not use layout, it has no idea about its own preferred size, so we can’t use this solution. What we usually do is manually set some extra constraints to try to get things to still somewhat work. You can do this by example by SetExplicitMinSize on your BBox to make sure it is large enough to accomodate what you put inside it.
I see. Is there any way to add a Layout to an existing BView to make that compatible again?
It should be enough to force some size constraints (using SetExplicitMinSize on the view, for example). There isn’t really a way to add a layout to an already constructed BView. It would be possible but quite complex. Usually it is simpler to just convert the code to layout everywhere.