Go ShowModal () = Mrok

Source: Internet
Author: User

if Form1.showmodal = Mrok Then what's the meaning of this sentence?

First, all command buttons (either button or bitbtn) have a property:Modalresult, which can be set to Mrok,mrcancel ... Wait, the default value is MrNone (Modalresult is an integer value, as long as you are using ShowModal, the window will automatically close when you pay it a nonzero value, and the Mrok value is 2).

In peacetime, themodalresult attribute is of little use, but it is useful if the command button is placed on a form that is displayed with ShowModal (modal display, typically used to display a dialog box).

The role is reflected in:

< Span lang= "en-us" xml:lang= "en-US" > 1, when the command button is set modalresult property is mrok, mrcancel ... Wait, after the program runs, click the button, the form that the button is on will automatically close without adding such as in onclick event close;  

2, when setting command button modalresult property is mrok, mrcancel ... Wait, when the program runs, click the button, the button's form will automatically close, and the button's modalresult attribute value to the form's modalresult Property (Note: Any form has this property!) )  

3. When the form is closed automatically, the Modalresult property of the form is automatically passed to the ShowModal method as the return value of the method. Therefore,the return value of the ShowModal method is always the same as the Modalresult property of the command button .   

 if Form1.showmodal = Mrok then  If you want to popularize, you can write the following equivalent code:

var R:tmodalresult; //  ...... .......   r:=ifthen//

it is clear that according to The return value of the ShowModal method determines whether the user clicks the OK button or the Cancel button in the dialog box to determine the program logic for the next step.

Go ShowModal () = Mrok

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.