RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomButton.ModalResult Property

Determines whether and how the button closes its (modal) parent form.

Pascal
property ModalResult: TModalResult;
C++
__property TModalResult ModalResult;

Setting the button component's ModalResult property is an easy way to make clicking the button close a modal form. When a button is clicked, the ModalResult property of its parent form is set to the same value as the button's ModalResult property. 

For example, if a dialog box has OK and Cancel buttons, their ModalResult properties could be set at design time to mrOk and mrCancel, respectively. At runtime, clicking the OK button then changes the dialog's ModalResult property to mrOk, and clicking the Cancel button changes the dialog's ModalResult property to mrCancel. Unless further processing is required, no OnClick event handlers are required for the buttons. 

The following constants are of TModalResult type and defined for the ModalResult property:

Constant 
Value 
Meaning 
mrNone  
0  
None. Used as a default value before the user exits.  
mrOk  
idOK  
The user exited with OK button.  
idCancel  
The user exited with the CANCEL button.  
idAbort  
The user exited with the ABORT button.  
idRetry  
The user exited with the RETRY button.  
idIgnore  
The user exited with the IGNORE button.  
mrYes  
idYes  
The user exited with the YES button.  
mrNo  
idNo  
The user exited with the NO button.  
mrAll  
mrNo + 1  
The user exited with the ALL button.  
mrAll + 1  
The user exited with the NO TO ALL button.  
mrNoToAll + 1  
The user exited with the YES TO ALL button.  
mrYesToAll + 1  
The user exited with the CLOSE button.  

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!