|
YCP UI Widget Reference
Back to the widget index
Left Right Top Bottom HCenter VCenter HVCenter
|
Layout alignment
|
|
Description
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
widget that it should be layouted 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. The important fact for all alignment widgets is, that they
make their child widget stretchable in the dimension it is aligned.
See the Layout HOWTO for details.
Arguments
term
|
child
|
The contained child widget
|
Optional
boolean
|
enabled
|
true if ...
|
Special Properties
None
Sample Usage
`Left( `CheckBox( "Crash every five minutes" ) )
Examples
{
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();
}
|
Back to the widget index
|