print_input_button

( <-- Back to Sporkl Function Library )


input print_input_button ( string name )


Displays an input button on screen.



Arguments:

name:
Text to be displayed on button

Returns:

A handle to the input value.

Notes:

Submits user entered data. At least one button must be displayed on screen before each load_user_input() call, otherwise user input can not be submitted for loading.

Multiple input buttons may be displayed on screen at any given time, any one of which will submit all user data when pressed. The button the user pushed can be determined by a get_input_value() call on the button's input handle - it will return "set" if the button was pushed, and "" otherwise.

Example:

The code:

print("Please press a button: ");
input but_a = print_input_button("Button A");
input but_b = print_input_button("Button B");

load_user_input();

if ( get_input_value(but_a)=="set" )
{
   print("You pushed button A.\n");
}
elseif ( get_input_value(but_b)=="set" )
{
   print("You pushed button B.\n");
}
else
{
   print("Neither button was pushed - this can't happen.\n");
}

will display two buttons on screen, and report which button was pushed after reload.









sporkforge