|
YCP UI Widget Reference
Back to the widget index
HBox VBox
|
Generic layout: Arrange widgets horizontally or vertically
|
|
Description
The layout boxes are used to split up the dialog and layout a number of
widgets horizontally ( HBox ) or vertically ( VBox ).
See the Layout HOWTO for details.
Arguments
None
Optional
term
|
child1
|
the first child widget
|
term
|
child2
|
the second child widget
|
term
|
child3
|
the third child widget
|
term
|
child4
|
the fourth child widget ( and so on... )
|
Special Properties
None
Options
`opt(`debugLayout)
|
verbose logging
|
Sample Usage
HBox( `PushButton( `id( `ok ), "OK" ), `PushButton( `id( `cancel ), "Cancel" ) )
Examples
{
UI::OpenDialog(
`VBox(
`PushButton("First"),
`PushButton("Second"),
`PushButton("Third")
)
);
UI::UserInput();
UI::CloseDialog();
}
|
{
UI::OpenDialog(
`HBox(
`PushButton("First" ),
`PushButton("Second"),
`PushButton("Third" )
)
);
UI::UserInput();
UI::CloseDialog();
}
|
{
// Layout example:
//
// Build a dialog with three equal sized buttons.
//
// The equal `HWeight()s will make the buttons equal sized.
// When resized, all buttons will resize equally in order to
// maintain the equal layout weights.
UI::OpenDialog(
`HBox(
`HWeight(1, `PushButton( `opt(`default), "&OK" ) ),
`HWeight(1, `PushButton( "&Cancel everything" ) ),
`HWeight(1, `PushButton( "&Help" ) )
)
);
UI::UserInput();
UI::CloseDialog();
}
|
{
// Layout example:
//
// Build a dialog with three widgets without any weights.
//
// Each widget will get its "nice size", i.e. the size that makes
// the widget's contents fit into it.
//
// Upon resize the widgets will keep their sizes if enlarged
// (since none of them is stretchable), i.e. there will be empty
// space to the right.
//
UI::OpenDialog(
`HBox(
`PushButton( `opt(`default), "OK" ),
`PushButton( "Cancel everything" ),
`PushButton( "Help" )
)
);
UI::UserInput();
UI::CloseDialog();
}
|
|
{
// Layout example:
//
// Build a dialog with three widgets with different weights and
// two widgets without any weight.
//
// All widgets will get at least their "nice size". The weighted
// ones may get even more to maintain their share of the overall
// weight.
//
// Upon resize all widgets will resize to maintain their
// respective weights at all times. The non-weighted widgets will
// retain their "nice size" regardless whether or not they are
// stretchable.
//
UI::OpenDialog(
`HBox(
`HWeight( 33, `PushButton( `opt(`default), "OK\n33%" ) ),
`PushButton( `opt(`hstretch), "Apply\nNo Weight" ),
`HWeight( 33, `PushButton( "Cancel\n33%" ) ),
`PushButton( "Reset to defaults\nNo Weight" ),
`HWeight( 66, `PushButton( "Help\n66%" ) )
)
);
UI::UserInput();
UI::CloseDialog();
}
|
Back to the widget index
|