Left, Right, Top, Bottom, HCenter, VCenter, HVCenter — Layout alignment
Left
( | term | child , |
`BackgroundPixmap( | "dir/pixmap.png"
) ; |
Right
( | term | child , |
`BackgroundPixmap( | "dir/pixmap.png"
) ; |
Top
( | term | child , |
`BackgroundPixmap( | "dir/pixmap.png"
) ; |
Bottom
( | term | child , |
`BackgroundPixmap( | "dir/pixmap.png"
) ; |
HCenter
( | term | child , |
`BackgroundPixmap( | "dir/pixmap.png"
) ; |
VCenter
( | term | child , |
`BackgroundPixmap( | "dir/pixmap.png"
) ; |
HVCenter
( | term | child , |
`BackgroundPixmap( | "dir/pixmap.png"
) ; |
The Alignment widgets are used to control the layout of a dialog. They are useful in situations, where to a widget is assigned more space than it can use. For example if you have a VBox containing four CheckBoxes, the width of the VBox is determined by the CheckBox with the longest label. The other CheckBoxes are centered per default.
With `Left( widget )
you tell a widget that it should be laid out leftmost of the space that is available to it. Right, Top
and Bottom
are working accordingly. The other three widgets center their child widget horizontally, vertically or in both directions.
As a very special case, alignment widgets that have `opt(`hvstretch) (and related) set promote their child widget's stretchability to the parent layout. I.e., they do not align a child that is stretchable in that dimension, but stretch it to consume the available space. This is only very rarely useful, such as in very generic layout code where the content of an alignment widget is usually unknown, and it might make sense to, say, center a child that is not stretchable, and OTOH to stretch a child that is stretchable.
An optional background pixmap can be specified as the first argument. UIs that support background pixmaps will then use the specified file as a (tiled) backgound image.
If that name does not start with "/" or ".", the theme path ("/usr/share/YaST2/theme/current/") will be prepended.
{ UI::OpenDialog( `VBox( `Label("This is a long label which makes space"), `HBox( `Label("A"), `HCenter(`Label("B")), `Label("C") ) ) ); UI::UserInput(); UI::CloseDialog(); }
{ UI::OpenDialog( `VBox( `Label("This is a very long label that makes space"), `HBox( `PushButton("Normal"), `HCenter(`PushButton("HCenter")) ) ) ); UI::UserInput(); UI::CloseDialog(); }
{ UI::OpenDialog(`opt(`defaultsize), `VBox( `VCenter(`PushButton(`opt(`vstretch), "Button 1")), `VCenter(`PushButton(`opt(`vstretch), "Button 2")), `VCenter(`PushButton(`opt(`vstretch), "Button 3")) ) ); UI::UserInput(); UI::CloseDialog(); }
{ UI::OpenDialog( `VBox( `PushButton("This is a very long button - it reserves extra space for the label."), `HBox( `PushButton(`opt(`hstretch), "Stretchable button"), `ReplacePoint(`id(`rp), `Label("Label")) ) ) ); UI::UserInput(); UI::ReplaceWidget(`id(`rp), `Left(`Label("Left"))); UI::UserInput(); UI::ReplaceWidget(`id(`rp), `Right(`Label("Right"))); UI::UserInput(); UI::ReplaceWidget(`id(`rp), `HCenter(`Label("HCenter"))); UI::UserInput(); }