Sign in Join
FPDoc Onlineexperiment

InputBox function

In unit Dialogs

Displays a box with specified title and prompt, and accepts user input in a text box.

Declaration

pascal
function InputBox(const ACaption: string; const APrompt: string; 
 const ADefault: string): string

Description

A default string can optionally be displayed in the text box. The user-entered or default string is returned as the function result.

If the user selects the OK button, the text in the text box is returned. If the user selects the Cancel button, the default string is returned.

See also

Example: inputbox.pas

pascal
uses 
  Forms, LCLType, Dialogs, Controls;

procedure TryInputBox;
var 
  userstring: string;
begin
  userstring := InputBox ('Get some text input', 
                          'Please type in some information', 
                          'Some sample text');
  ShowMessage(userstring);
end;

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.