From Clomosy Docs

No edit summary
No edit summary
Line 11: Line 11:
  begin
  begin
   repeat
   repeat
     if not InputQuery('Test program', 'Please type your name', valueName)
     if not InputQuery('Project', 'Please type your name', valueName)
     then ShowMessage('User cancelled the dialog');  
     then ShowMessage('User cancelled the dialog');  
   until valueName <> <nowiki>''</nowiki>;
   until valueName <> <nowiki>''</nowiki>;
Line 17: Line 17:
   ShowMessage('Hello '+valueName);
   ShowMessage('Hello '+valueName);
  end;
  end;
'''Output:'''<br>
[[File:InputQueryExample.png|frameless|400px]]

Revision as of 05:42, 28 March 2023

function InputQuery(const Caption, Prompt string; var UserValue string):Boolean;

The InputQuery function displays a simple dialog with the Caption and Prompt message provided. Prompts the user to enter data in a text box in the dialog. If the user presses OK, the entered data is stored in the UserValue variable and the return value is True. If the user cancels the dialog, the return value is False and all entered data is lost.

Use to prompt the user for simple data such as name.

Example:

var
 valueName : string;

begin
 repeat
   if not InputQuery('Project', 'Please type your name', valueName)
   then ShowMessage('User cancelled the dialog'); 
 until valueName <> '';

 ShowMessage('Hello '+valueName);
end;

Output:

InputQueryExample.png