Use of InputBox and Inputquery functions in Delphi

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.