Yast UI
YWidget Class Reference

Generic options for all widgetsNon-standard Opt() arguments: notify Make UserInput() return on any action in this widget. Normally UserInput() returns only when a button is clicked; with this option on you can make it return for other events, too, e.g. when the user selects an item in a SelectionBox ( if Opt( :notify ) is set for that SelectionBox ). Only widgets with this option set are affected. More...

Detailed Description

Generic options for all widgets

Non-standard Opt() arguments: notify Make UserInput() return on any action in this widget. Normally UserInput() returns only when a button is clicked; with this option on you can make it return for other events, too, e.g. when the user selects an item in a SelectionBox ( if Opt( :notify ) is set for that SelectionBox ). Only widgets with this option set are affected.

Following widget variants exist: AAA_All-Widgets Non-standard Opt() arguments: notifyContextMenu Make this widget to send an event when the context menu is requested e.g. when the user clicks right mouse button ( if Opt( :notifyContextMenu ) is set for that SelectionBox ). Only widgets with this option set are affected.

Non-standard Opt() arguments: disabled Set this widget insensitive, i.e. disable any user interaction. The widget will show this state by being greyed out (depending on the specific UI).

Non-standard Opt() arguments: hstretch Make this widget stretchable in the horizontal dimension.

Non-standard Opt() arguments: vstretch Make this widget stretchable in the vertical dimension.

Non-standard Opt() arguments: hvstretch Make this widget stretchable in both dimensions.

Non-standard Opt() arguments: autoShortcut Automatically choose a keyboard shortcut for this widget and don't complain in the log file about the missing shortcut. Don't use this regularly for all widgets - manually chosen keyboard shortcuts are almost always better than those automatically assigned. Refer to the style guide for details. This option is intended used for automatically generated data, e.g., RadioButtons for software selections that come from file or from some other data base.

Non-standard Opt() arguments: key_F1 (NCurses only) activate this widget with the F1 key Non-standard Opt() arguments: key_F2 (NCurses only) activate this widget with the F2 key Non-standard Opt() arguments: key_Fxx (NCurses only) activate this widget with the Fxx key Non-standard Opt() arguments: key_F24 (NCurses only) activate this widget with the F24 key Non-standard Opt() arguments: key_none (NCurses only) no function key for this widget

Non-standard Opt() arguments: keyEvents (NCurses only) Make UserInput() / WaitForEvent() return on keypresses within this widget. Exactly which keys trigger such a key event is UI specific. This is not for general use.

This is not a widget for general usage, this is just a placeholder for descriptions of options that all widgets have in common.

Use them for any widget whenever it makes sense.

Example:

# encoding: utf-8
module Yast
class AutoShortcut1Client < Client
def main
Yast.import "UI"
# (Minimalistic) Demo for automatically generated shortcuts.
#
# See 'AutoShortcut2.ycp' for a more realistic example.
#
# Please note this is _not_ how this option is meant to be used:
# It is intended for automatically generated data, not for fixed widgets.
# If you know your widget label at this point, manually add a keyboard
# shortcut; this will almost always be much better than anything what can
# be automatically generated.
#
#
# There shouldn't be any complaints about shortcuts in the log file when this is started.
UI.OpenDialog(
VBox(
RadioButtonGroup(
Frame(
"Software Selection",
HVSquash(
VBox(
Left(RadioButton(Opt(:autoShortcut), "Minimum System")),
Left(RadioButton(Opt(:autoShortcut), "Minimum X11 System")),
Left(RadioButton(Opt(:autoShortcut), "Gnome System")),
Left(RadioButton(Opt(:autoShortcut), "Default (KDE)")),
Left(RadioButton(Opt(:autoShortcut), "Default + Office")),
Left(RadioButton(Opt(:autoShortcut), "Almost Everything"))
)
)
)
),
PushButton("&OK")
)
)
UI.UserInput
UI.CloseDialog
nil
end
end
end
Yast::AutoShortcut1Client.new.main

Example:

# encoding: utf-8
module Yast
class AutoShortcut2Client < Client
def main
Yast.import "UI"
# Demo for automatically generated shortcuts.
#
# This is a more realistic example - it points out how the `autoShortcut
# option is intended to be used. See 'AutoShortcut1.ycp' for a simpler example.
#
# There shouldn't be any complaints about shortcuts in the log file when this is started.
@sw_selections = [
"Minimum System",
"Minimum X11 System",
"Gnome System",
"Default (KDE)",
"Office System (KDE Based)",
"Almost Everything"
]
@radio_box = VBox()
Builtins.foreach(@sw_selections) do |sel|
@radio_box = Builtins.add(
@radio_box,
Left(RadioButton(Opt(:autoShortcut), sel))
)
end
Builtins.y2milestone("radio_box: %1", @radio_box)
UI.OpenDialog(
VBox(
RadioButtonGroup(Frame("Software Selection", HVSquash(@radio_box))),
PushButton("&OK")
)
)
UI.UserInput
UI.CloseDialog
nil
end
end
end
Yast::AutoShortcut2Client.new.main

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