The Input Function

 

The INPUT function accepts input from the user as described below.

 

INPUT(

type, "prompt", "help", "default", low, high)

type

-

Optional. An integer, the type of data to enter:

  1:

Real (default)

  2:

Integer

  3:

String in quotes

  4:

Series

  5:

Literal, a series, Window or any expression

"prompt"

-

Optional. A string written at the beginning of the text entry line in quotes. The string is followed by a colon. Defaults to "Input:".

"help"

-

Optional. A string written at the bottom of the screen in quotes. Defaults to "Enter Number.".

"default"

-

Optional. A string written on the text enter line as a default input value in quotes. Defaults to nothing.

low

-

Optional. A scalar. The low limit on the enter value, or the smallest number of characters to enter if type = 3. Defaults to no low limit.

high

-

Optional. A scalar. The high limit on the enter value, or the largest number of characters to enter if type = 3. Defaults to no high limit.

 

When using INPUT in a menu, the optional message arguments are ignored.  Of interest are the type of data required, and the high and low delimiters (if desired). DADiSP does not allow the user to move from an input field in a menu unless the input is valid.

 

Here is an example of a dialog that generates a user specified number of random values:

 

// dialog2a.pan

// obtain integer input

@dialog

 

Generate Noise

 

Length: <w=20>~Gnormal(< >,.01)~input(2)

<L>

~menuclear

 

 

 

 

Note the display field includes the w=20 modifier to explicitly set the width of the input field to 20 characters. The input(2) statement inputs an integer value from the user.

 

To input an integer with a discrete up/down control, simply add the d (down) or u (up) discrete increment modifier.

 

// dialog2b.pan

// obtain integer input

@dialog

 

Generate Noise

 

Length: <d w=20>~Gnormal(< >,.01)~input(2)

<L>

~menuclear