Translated from: http://blog.csdn.net/zengcong2013/article/details/18355959
The return value of InputBox is the text that you enter in the input box. The return value of inputquery is whether you clicked the OK button. The return value of this is a Boolean type. If you do not enter the same in InputBox, click Cancel, you will be prompted to error, and Inputquery will not. The two parameters in front of them are the same, they are the caption of the input box, and the prompt information. Cases:
If InputBox (' addition problem ', ' 7+5 ', ') = '
ShowMessage (' yes ')
Else
ShowMessage (' no ')
The point cancellation and the third argument not equal to the function return false;
Var
inputtext:string;
If Inputquery (' Info ', ' Enter password ', inputtext) =true Then
Begin
End
The user-entered string can be obtained through InputBox:
procedure Tform1.button1click (Sender:tobject); var string; begin str: = InputBox (' input window title ', ' Input hint ', ' default input '); ShowMessage (str); Display the input end;
InputBox is called Inputquery, Inputquery is getting a new string with a var parameter:
procedure Tform1.button2click (Sender:tobject); var string; begin Inputquery (' input window title ', ' Input hint ', str); ShowMessage (str); Display the input end;
Inputquery can return a Boolean value that can be used to determine whether the user is confirming or canceling, which is useful:
procedure Tform1.button3click (Sender:tobject); var string; begin str: = ' default input content '; if then ShowMessage (str); If the OK button is clicked, the input endis displayed;d
Use of InputBox and Inputquery functions in Delphi