InputBox(
Caption: String;
Prompt: String;
Var Data: String;
[ParentWindow: IWin32Window = Null]): Boolean;
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.
The InputBox method opens a standard data edit box and returns the result of dialog box closing.
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.
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.
Executing the example requires a .NET form with a button.
Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Ui;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
WinAppCls: WinApplicationClass = New WinApplicationClassClass();
s: String;
b: Boolean;
Begin
b := WinAppCls.InputBox("Change data", "New value", Var s, New IWin32WindowForeAdapter(Self));
If b Then
Self.Text := s;
End If;
End Sub;
Clicking the button opens the data input dialog box. The entered value is set as a form header if the OK button has been clicked in the dialog box.
See also: