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