Question
How to Cancel the closing of a Dialog Box?
Answer
There will be times when you may wish the disallow the user from closing a dialog box when the user clicked the system close button, Ok or Cancel buttons or pressed the Esc key. To do this, the Modal and Modeless dialog boxes have been provided with the CancelClose event. Add this event to your lisp code by selecting the CancelClose of the properties wizard dialog box and pressing the 'Add to .Lsp File' button. The following code below will allow you to tell ObjectDCL if closing should be allowed.
... (setq AllowClose T) ... (defun c:DclForm1_DclForm1_CancelClose (bUserPressedEsc / rCancelClose) (setq rCancelClose nil) ; AllowClose is a global variable that you must setup yourself in your program to indicate to this event to the close the dilaog box ; Please keep track of user settings in your program to determine if this dialog box should be closed or not. (if (= AllowClose T) ; set the returning variable to allow the dialog box to close (setq rCancelClose nil) ; else set the returning variable to NOT allow the dialog box to close (setq rCancelClose T) ) ; place the variable here to return a value to ObjectDCL to inform it should cancel the close. rCancelClose )
Knowledge Base
FAQ