|
YCP UI Widget Reference
Back to the widget index
AAA_All-Widgets
|
Generic options for all widgets
|
|
Description
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.
Arguments
None
Special Properties
boolean
|
Enabled
|
the current enabled/disabled state
|
boolean
|
Notify
|
the current notify state ( see also `opt( `notify ) )
|
Options
`opt(`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.
|
`opt(`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 ).
|
`opt(`hstretch)
|
Make this widget stretchable in the horizontal dimension.
See the Layout HOWTO for details.
|
`opt(`vstretch)
|
Make this widget stretchable in the vertical dimension.
See the Layout HOWTO for details.
|
`opt(`hvstretch)
|
Make this widget stretchable in both dimensions.
See the Layout HOWTO for details.
|
`opt(`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.
|
`opt(`key_F1)
|
(NCurses only) activate this widget with the F1 key
|
`opt(`key_F2)
|
(NCurses only) activate this widget with the F2 key
|
`opt(`key_Fxx)
|
(NCurses only) activate this widget with the Fxx key
|
`opt(`key_F24)
|
(NCurses only) activate this widget with the F24 key
|
`opt(`key_none)
|
(NCurses only) no function key for this widget
|
`opt(`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.
|
Sample Usage
---
Examples
{
// (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();
}
|
{
// 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.
list sw_selections =
[
"Minimum System",
"Minimum X11 System",
"Gnome System",
"Default (KDE)",
"Office System (KDE Based)",
"Almost Everything",
];
term radio_box = `VBox();
foreach ( `sel, sw_selections, ``{
radio_box = add( radio_box, `Left( `RadioButton(`opt(`autoShortcut), sel ) ) );
} );
y2milestone( "radio_box: %1", radio_box );
UI::OpenDialog(
`VBox(
`RadioButtonGroup(
`Frame( "Software Selection",
`HVSquash( radio_box )
)
),
`PushButton( "&OK" )
)
);
UI::UserInput();
UI::CloseDialog();
}
|
Back to the widget index
|