Name

MarginBox — Margins around one child widget

Synopsis

MarginBox ( float  horMargin ,
  float  vertMargin ,
  term  child );

Parameters

float horMargin

margin left and right of the child widget

float vertMargin

margin above and below the child widget

term child

The contained child widget

Description

This widget is a shorthand to add margins to the sides of a child widget (which may of course also be a VBox or a HBox, i.e. several widgets).

Unlike more complex constructs like nested VBox and HBox widgets with VSpacing and HSpacing at the sides, the margins of a MarginBox have lower layout priorities than the real content, so if screen space becomes scarce, the margins will be reduced first, and only if the margins are zero, the content will be reduced in size.

Usage

 	`MarginBox( 0.2, 0.3, `Label( "Hello" ) );
 	`MarginBox( `leftMargin( 0.7,), `rightMargin( 2.0 ), `topMargin( 0.3 ), `bottomMargin( 0.8 ), `Label( "Hello" ) );

Examples

          {
    UI::OpenDialog(
		   `VBox(
			 `MarginBox( 10, 2, `Label("Hello, World!") ),
			 `PushButton(`opt(`default), "&OK")
			 )
		   );
    UI::UserInput();
    UI::CloseDialog();
}

        
          {
    UI::OpenDialog(
		   `VBox(
			 `MarginBox(`leftMargin( 10 ), `rightMargin( 20 ), `topMargin( 2 ), `bottomMargin( 3.5 ),
				    `Label("Hello, World!") ),
			 `PushButton(`opt(`default), "&OK")
			 )
		   );
    UI::UserInput();
    UI::CloseDialog();
}