RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TButton.ModalResult Property

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

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

Setting the TButton 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 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.  
mrCancel  
idCancel  
The user exited with the CANCEL button.  
mrAbort  
idAbort  
The user exited with the ABORT button.  
mrRetry  
idRetry  
The user exited with the RETRY button.  
mrIgnore  
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.  
mrNoToAll  
mrAll + 1  
The user exited with the NO TO ALL button.  
mrYesToAll  
mrNoToAll + 1  
The user exited with the YES TO ALL button.  

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!