YaST2 Developers Documentation: YCP UI Reference: Widgets



YCP UI Widget Reference

Back to the widget index

IntField Numeric limited range input field

Description

A numeric input field for integer numbers within a limited range. This can be considered a lightweight version of the Slider widget, even as a replacement for this when the specific UI doesn't support the Slider. Remember it always makes sense to specify limits for numeric input, even if those limits are very large ( e.g. +/- MAXINT ).

Fractional numbers are currently not supported.

Arguments

string label Explanatory label above the input field
integer minValue minimum value
integer maxValue maximum value
integer initialValue initial value

Special Properties

integer Value the numerical value
string Label the slider label

Sample Usage

`IntField( "Percentage", 1, 100, 50 )

Examples

Example 1: IntField1.ycp


{
    UI::OpenDialog(
	       `VBox(
		     `IntField( "Percentage:", 0, 100, 50),
		     `PushButton(`opt(`default), "&OK")
		     )
	       );
    UI::UserInput();
    UI::CloseDialog();
}
		

Example 2: IntField2.ycp


{
    UI::OpenDialog(
	       `VBox(
		     `IntField( `id(`perc), "Percentage:", 0, 100, 50),
		     `PushButton(`opt(`default), "&OK")
		     )
	       );
    UI::UserInput();
    
    integer percentage = (integer) UI::QueryWidget(`id(`perc), `Value);
    UI::CloseDialog();
    
    UI::OpenDialog(
	       `VBox(
		     `Label( sformat( "You entered: %1%%", percentage) ),
		     `PushButton(`opt(`default), "&OK")
		     )
	       );
    UI::UserInput();
}
		

Back to the widget index


YaST2 Developers Documentation: YCP UI Reference: Widgets

Generated Fri May 21 12:39:01 2004