Hi,
after quite long playing with achieving layout[1] I decide to write down what I 
found.

Short Version
-------------

To get nice box centered at middle of screen, but content in box left aligned 
use
HBox(
  HStretch,
  VBox(
    VStretch,
    Left(<content>),
    VStretch
  ),
  HStretch
)
    

Long Version
------------

It start with feature to adapt theme and our designed team found some strange 
alignment that they want to change in dialog layout.
So I start with trivial idea to have something like 
`Center(VBox(Left(*content)))` This sadly does not work as it in
the end create box over whole place and everything is ugly on left side. which 
looks strange ( see screenshots in [1]).
So next attempt with a bit of help is MarginBox. It looks fine and is 
shrinkable, so even on very small screen in ncurses
looks fine, but in qt it is hard to pick good sizes as with different 
resolutions it is never on center for all resolutions.
So good to make some spacing, but not to align box.
The proper solution is to use that stretches around that create spacing around 
box that is proportional and content in Box
then can left alignment with proper position.

Pro tip: If you do not want center but e.g. in one third, it is possible to use 
Weight to stretch. See documentation at [2]

Josef

[1] https://github.com/yast/yast-registration/pull/519
[2] https://yast-ui-bindings.surge.sh/classYWeight.html
_______________________________________________
YaST Development mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/[email protected]

Reply via email to