Pages

Saturday, November 9, 2013

How to show prompt dialog in delphi


In this post we will discuss about How to show prompt dialog in delphi that will ask user to input some string to be processed. In delphi we can use inputbox function.

The InputBox function displays a simple dialog box with the given Caption and Prompt message. It asks the user to enter data in a text box on the dialog. A Default value is displayed in the text box.

If the user presses OK, the default or user entered data is stored in the return string, otherwise an empty string is returned.

If the user cancels the dialog, then the return value is the default string.

The script below are the sample of inputbox function usage :

var
  value : string;

begin
  // Keep asking the user for their town
  repeat
    value := InputBox('Name', 'Please type your name', 'Robert');
  until value <> '';

  // Show their name
  ShowMessage('Your name is '+value);
end;

No comments:

Post a Comment

Don't Forget To Join Our Community
×
Widget