FMX.Dialogs.InputBox

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function InputBox(const ACaption, APrompt, ADefault: string): string; overload;
procedure InputBox(const ACaption, APrompt, ADefault: string; const ACloseBoxProc: TInputCloseBoxProc); overload;

C++

extern DELPHI_PACKAGE System::UnicodeString __fastcall InputBox(const System::UnicodeString ACaption, const System::UnicodeString APrompt, const System::UnicodeString ADefault)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
FMX.Dialogs.pas
FMX.Dialogs.hpp
FMX.Dialogs FMX.Dialogs


Description

Displays a dialog box for entering text.

InputBox expects the following parameters:

  • <ACaption> represents the title of the dialog box.
  • <APrompt> represents the label located on the left of the TEdit.
  • <ADefault> represents the default text of the TEdit.
  • <ACloseBoxProc> (optional) is an anonymous method that InputBox executes when the dialog box closes.

If the user clicks the OK button, InputBox returns the text entered in the TEdit control of the dialog box. If the user clicks the Cancel button, InputBox returns the value of the <ADefault> parameter. If you provide the <ACloseBoxProc> parameter, InputBox does not return any value; the <AValue> argument passed to the <ACloseBoxProc> method contains the user input instead.

If a call to InputBox does not include the <ACloseBoxProc> parameter, the call is blocking on all platforms; that is, InputBox does not return until the dialog box closes. Android does not support these blocking calls, you can only use InputBox on Android if you provide the <ACloseBoxProc> parameter.

Calls to InputBox that include the <ACloseBoxProc> parameter are also blocking on desktop platforms but they are non-blocking on mobile platforms; that is, on mobile platforms any code that you place after a call to InputBox is executed before the dialog box closes. If you need to execute code after your dialog box closes, use the <ACloseBoxProc> parameter of InputBox to define an anonymous method that runs that code. See:

Platform Support

The following table summarizes which platforms support which calls to InputBox and whether those calls are blocking or non-blocking:

Platform Without <ACloseBoxProc> With <ACloseBoxProc>
Windows Blocking Blocking
Mac OS X Blocking Blocking
iOS Blocking Non-blocking
Android Non-blocking

See Also