OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Closing the dialog box

Every dialog box must have a way for the user to close it.

For dialog boxes, this is usually an OK or Cancel button, or both. TDialog has the event response functions TDialog::CmOk() and TDialog::CmCancel() to respond to those buttons. CmOk calls CloseWindow, which calls CanClose to see if it is OK to close the dialog box. If CanClose returns true, CloseWindow transfers the dialog's data and closes the dialog box by calling TWindow::CloseWindow().

CmCancel calls EvClose, which in turn calls Destroy, which closes the dialog box. No checking of CanClose is performed, and no transfer is done. To verify the input in a dialog box, you can override the dialog box object's CanClose member function. If you override CanClose, be sure to call the parent TWindow::CanClose() function, which handles calling CanClose for child windows.

See Also