Defining the Dialog Box With DCL

Begin by taking a look at the dialog box you need to create.

The dialog box contains the following elements:

Dialog box components are referred to as tiles in DCL. Writing the complete contents of a dialog box DCL file may seem overwhelming. The trick is to sketch out what you want, break it down into sections, then write each section.

To define the dialog box

  1. Open a new file in the Visual LISP text editor window.
  2. Enter the following statement in the new file:
    label = "Garden Path Tile Specifications";

    This DCL statement defines the title of the dialog box window.

  3. Define the radio buttons for specifying polyline type by adding the following code:
    : boxed_radio_column {    // defines the radio button areas
      label = "Outline Polyline Type";
      : radio_button {        // defines the lightweight radio button
        label = "&Lightweight";
        key = "gp_lw";
        value = "1";
       }
    : radio_button {       // defines the old-style polyline radio button
      label = "&Old-style";
      key = "gp_hw";
     }
    }

    The boxed_radio_column DCL directive defines a box boundary and allows you to specify a label for the set of buttons. Within the boundary, you specify the radio buttons you need by adding radio_button directives. Each radio button requires a label and a key. The key is the name by which your AutoLISP code can refer to the button.

    Notice that the radio button labeled “lightweight” is given a value of 1. A value of 1 (a string, not an integer) assigned to a button makes it the default choice in a row of buttons. In other words, when you first display the dialog, this button will be selected. Also notice that in DCL files, double-slash characters, not semicolons as in AutoLISP, indicate a comment.

  4. Define the radio column for the selection of the entity creation style by adding the following code:
    : boxed_radio_column {     // defines the radio button areas
      label = "Tile Creation Method";
      : radio_button {         // defines the ActiveX radio button
        label = "&ActiveX Automation";
        key = "gp_actx";
        value = "1";
       }
    : radio_button {          // defines the (entmake) radio button
      label = "&Entmake";
      key = "gp_emake";
     }
    : radio_button {          // defines the (command) radio button
      label = "&Command";
      key = "gp_cmd";
     }
    }
  5. Add the following code to define the edit box tiles that allow users to enter the numbers specifying tile size and spacing:
    : edit_box {      // defines the Radius of Tile edit box
      label = "&Radius of tile";
      key = "gp_trad";
      edit_width = 6;
    }
    : edit_box {      // defines the Spacing Between Tiles edit box
      label = "S&pacing between tiles";
      key = "gp_spac";
      edit_width = 6;
    }

    Notice that this definition does not set any initial values for the edit boxes. You will set default values for each edit box in your AutoLISP program.

  6. Add the following code for the OK and Cancel buttons:
    : row {          // defines the OK/Cancel button row
      : spacer { width = 1; }
      : button {    // defines the OK button
        label = "OK";
        is_default = true;
        key = "accept";
        width = 8;
        fixed_width = true;
      }
      : button {    // defines the Cancel button
        label = "Cancel";
        is_cancel = true;
        key = "cancel";
        width = 8;
        fixed_width = true;
      }
      : spacer { width = 1;}
    }

    Both buttons are defined within a row, so they line up horizontally.

  7. Scroll to the beginning of the text editor window and insert the following statement as the first line in your DCL:
    gp_mainDialog : dialog {
  8. The dialog directive requires a closing brace, so scroll to the end of the file and add the brace as the last line of DCL code:
    }