Yast UI
LayoutBox Class Reference

Generic layout: Arrange widgets horizontally or verticallyOptional Argument: term child1 the first child widget Optional Argument: term child2 the second child widget Optional Argument: term child3 the third child widget Optional Argument: term child4 the fourth child widget ( and so on... ) Non-standard Opt() arguments: debugLayout verbose logging. More...

Detailed Description

Generic layout: Arrange widgets horizontally or vertically

Optional Argument: term child1 the first child widget Optional Argument: term child2 the second child widget Optional Argument: term child3 the third child widget Optional Argument: term child4 the fourth child widget ( and so on... ) Non-standard Opt() arguments: debugLayout verbose logging.

Following widget variants exist: HBox VBox Id of widget: Box Example:

# encoding: utf-8
module Yast
class VBox1Client < Client
def main
Yast.import "UI"
UI.OpenDialog(
VBox(PushButton("First"), PushButton("Second"), PushButton("Third"))
)
UI.UserInput
UI.CloseDialog
nil
end
end
end
Yast::VBox1Client.new.main

Example:

# encoding: utf-8
module Yast
class HBox1Client < Client
def main
Yast.import "UI"
UI.OpenDialog(
HBox(PushButton("First"), PushButton("Second"), PushButton("Third"))
)
UI.UserInput
UI.CloseDialog
nil
end
end
end
Yast::HBox1Client.new.main

Example:

# encoding: utf-8
module Yast
class LayoutButtonsEqualGrowingClient < Client
def main
Yast.import "UI"
# 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
nil
end
end
end
Yast::LayoutButtonsEqualGrowingClient.new.main

Example:

# encoding: utf-8
module Yast
class LayoutFixedClient < Client
def main
Yast.import "UI"
# 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
nil
end
end
end
Yast::LayoutFixedClient.new.main

Example:

# encoding: utf-8
module Yast
class LayoutMixedClient < Client
def main
Yast.import "UI"
# 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
nil
end
end
end
Yast::LayoutMixedClient.new.main

The layout boxes are used to split up the dialog and layout a number of widgets horizontally ( HBox ) or vertically ( VBox ).

Rather than HBox use ButtonBox for placing PushButton items in a pop-up dialog. Then it automatically places them in the correct order depending on a selected UI.


The documentation for this class was generated from the following file: