Name

IntField — Numeric limited range input field

Synopsis

IntField ( string label ,
  integer minValue ,
  integer maxValue ,
  integer initialValue );
 

Parameters

string label

Explanatory label above the input field

integer minValue

minimum value

integer maxValue

maximum value

integer initialValue

initial value

Description

A numeric input field for integer numbers within a limited range. This can be considered a lightweight version of the <link linkend="Slider_widget">Slider</link> 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.

Usage

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

Examples

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

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