It was noted earlier that a single DCL file may contain multiple dialog box definitions. The next step in using a dialog is to specify which dialog box definition to display. The following code demonstrates this:
(if (and dialogLoaded
(not (new_dialog "gp_mainDialog" dcl_id))
) ;_ end of and
;; There's a problem...
(princ "\nCannot show dialog gp_mainDialog")
(setq dialogShow nil)
) ;_ end of progn
) ;_ end of if
Notice how the and function is used to test if the dialog was loaded and if the call to new_dialog was successful. If there are multiple expressions evaluated within an and function call, evaluation of subsequent expressions is terminated with the first expression that evaluates to nil. In this case, if the dialogLoaded flag is nil (meaning the load function in the previous section failed), VLISP does not attempt to perform the new_dialog function.
The new_dialog function simply loads the dialog into memory—it does not display it. The start_dialog function displays the dialog box. All dialog box initialization, such as setting tile values, creating images or lists for list boxes, and associating actions with specific tiles must take place after the new_dialog call and before the start_dialog call.