IWinApplicationClass.InputBox

Syntax

InputBox(

Caption: String;

Prompt: String;

Var Data: String;

[ParentWindow: IWin32Window = Null]): Boolean;

Parameters

Caption. Dialog box header.

Prompt. The message shown above the edit box. The : characters will be automatically inserted into the end of the defined message.

Data. The variable, to which the entered value is put.

ParentWindow. The parent window, for which the dialog box opens modally. The Null value is passed by default, the dialog box opens modally for the current window.

Description

The InputBox method opens a standard data edit box and returns the result of dialog box closing.

Comments

It is used only in the desktop application.

On clicking the OK button the method returns True, and the entered value is put into the variable defined in the Data parameter.

On clicking the Cancel button the method returns False. The empty string is contained in the variable defined as the Data parameter.

Example

Executing the example requires a form and a button named Button1 on the form.

Add a link to the UI system assembly.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    s: String;
    b: Boolean;
Begin
    b := WinApplication.InputBox("Change data""New value", s);
    If b Then
        Self.Text := s;
    End If;
End Sub Button1OnClick;

Clicking the button shows the data input dialog box on the desktop. The entered value is set as a form header if the OK button has been clicked in the dialog box.

See also:

IWinApplicationClass