次の方法で共有


INPUTBOX( ) Function

Displays a modal dialog used by a parameterized view for input of a single string.

INPUTBOX(cInputPrompt [, cDialogCaption [, cDefaultValue [, nTimeout [,cTimeoutValue] [,cCancelValue]]]])

Parameters

  • cInputPrompt
    Specifies the Prompt displayed above the text entry box.

  • cDialogCaption
    Specifies the text to display in the title bar of the dialog box.

  • cDefaultValue
    Specifies a default value to display in the text entry box.

  • nTimeout
    Specifies a timeout value in 1/1000 seconds.

    Specify zero in nTimeout to prevent the dialog from timing out. This is identical to omitting nTimeout.

  • cTimeoutValue
    Specifies value to return if a timeout occurs. cTimeoutValue isn't returned if nTimeout is set to zero or is omitted.

  • cCancelValue
    Specifies a character value to return if the user exits the dialog box by choosing the Cancel button or pressing the Esc key.

Remarks

The dialog box displays an edit box and OK and Cancel buttons. The OK button returns the contents of the edit box. A timeout returns the text specified in cTimeoutValue or an empty string if cTimeoutValue is unspecified. The Cancel button or the Esc key returns the text specified in cCancelValue or an empty string if cCancelValue is unspecified.

Example 1

Code

Y = "Nothing at all"
Y = INPUTBOX("TypeHere","Input ",Y,5000)
         && Displays dialog box for 5 seconds, 

Example 2

The following example displays a dialog box for five seconds and displays the return value in the main Visual FoxPro window. If the user clicks OK, the edit box returns the text which is either the default value, "Nothing at all," or user-specified text. If the user clicks Cancel or hits the ESC key, the edit box returns "Canceled." If the user waits the timeout period, the edit box closes and returns "Timed Out."

Code

CLEAR
Y = INPUTBOX("Type Here:", "Input Title",  ;
"Nothing at all", 5000, 'Timed Out', 'Canceled')
? Y

See Also

Reference

INPUT Command

MESSAGEBOX( ) Function

Other Resources

Functions

Input and Output (Visual FoxPro)