This example starts with a simple dialog box:
The following DCL defines the dialog box:
hello : dialog {
label = "Sample Dialog Box";
: text { label = "Hello, world."; }
ok_only;
}
This DCL defines a dialog box labeled Sample Dialog Box that contains a text tile and a single OK button. The DCL resides in a file named hello.dcl.
To display the dialog box and respond to the user pressing OK
(setq dcl_id (load_dialog "hello.dcl"))
load_dialog function returns a DCL identification number. You need this to identify the dialog in subsequent function calls.
The(new_dialog "hello" dcl_id)
ok_only, so you do not have to initialize the tile unless you want to override its default values. The ok_only tile also has an action named done_dialog assigned to it. If the user presses the OK button, AutoCAD passes the done_dialog call to your AutoLISP application and ends the dialog.
The DCL example above uses a predefined tile named(start_dialog)
new_dialog function returning a non-nil value. For the sake of simplicity, no error processing is included in this example.
Steps 3, 4, and 5 are dependent on theYou can use the following function to call the sample dialog box:
(defun C:HELLO( / dcl_id )
(setq dcl_id (load_dialog "hello.dcl")) ; Load the DCL file.
(if (not (new_dialog "hello" dcl_id)) ; Initialize the dialog.
(exit) ; Exit if this doesn't
; work.
)
(start_dialog) ; Display the dialog
; box.
(unload_dialog dcl_id) ; Unload the DCL file.
(princ)
)
Enter this code into a new VLISP text editor window and load the program by choosing Tools Load Text in Editor from the VLISP menu. To display the dialog box, enter (c:hello) at the VLISP Console prompt.
start_dialog call remains active until the user selects a tile (usually a button) whose associated action expression calls done_dialog. The done_dialog call can be issued explicitly by the tile. The done_dialog call is also issued by the selected tile if its is_cancel attribute is set to true.
Note that the