Getting Started with

Dcl Dialogs

 
 
Tutorial Download Introduction Introduction My Dialogs Dcl Calcs View Dcl Show Icons Get Icon & Questions &
Overview Files to AutoLISP to Dialogs Menu Get Buttons Comments
                       
 
 

Tutorial Overview

 
 

In this tutorial for "Getting Started with Dcl Dialogs", there are examples of all of the basic dcl tiles with an accompanying AutoLISP program to load and control the dialogs. The approach is learning by examples. In this document the dialogs with the green title bars have active html menu selections. The dialogs with the blue title bars are only the dialog examples for the tutorial.

 

This tutorial is intended for all AutoLISP programmers, from the novice to the advanced. The more advanced programmers will find DclCalcs very beneficial while designing dialogs. Its algorithms for calculating heights and widths verses pixels and incremental changes to tiles, greatly speeds up the design process. It reduces a lot of the estimating and guess work required to finally find a height or width that works for what you are designing. If you have ever attempted to design a list_box with only 5 or 10 lines and have wasted way too much time and still couldn’t find a height that worked, DclCalcs will show you all of the lines that are skipped within a reasonable range.

 

Among the main topics of interest covered in this tutorial is moving back and next through a series of dialogs and retaining all of the previous dialog information. Another topic of interest is to be able to exit a dialog, and have the user select an object, and then return to the dialog and display the information regarding the object selected.

 

Additional utilities are included labeled with the comment ";*Included" at the end of the line. Among these utilities are functions for the edit_box and popup_list to only accept integers or real numbers as input from the users. For the popup_list, an alternative to adding to a list by typing in a new value as in VBA, the "Other" option has been added as a solution.

 

ViewDcl is also included in this tutorial. ViewDcl is a very useful utility for viewing dialogs within dcl files, as you are designing them or just need to view or compare other dialogs. If this type of utility is not part or your preferred AutoLISP and Dialog editor, it is a great utility to have. It can be run on the command line without loading any editor.

 

In addition to the AutoLISP and Dialogs covered in this tutorial you can refer to the Support Functions and Support Dialogs within the accompanying AutoLISP and Dialogs files, MyDialogs.lsp and MyDialogs.dcl. In consideration that some users may already have files named DclDialogs, I chose the name MyDialogs. It is my intention, that once you download these files, they’re yours to edit and modify and call your own.

 
 

My Dialogs Download Files

   My Dialogs Download Files
     
  MyDialogs.lsp MyDialogs.dcl
     
  Bolt_Top.sld Nut_Washer.sld
     
  Nut_Top.sld Nut.sld
     

Select Files to Download

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
 

Introduction to AutoLISP

 

There are two basic types of AutoLISP functions, the Command type and the Function type. The function name for the Command type is preceded with a "c:". The Command type is typically run from the command line by typing in the name of the function. It may also be run by typing the "c:" and the function name enclosed in parentheses. i.e. (c:fun1). This method is used to call a Command function within another function. The Function type is always enclosed in parentheses and may include various arguments after the function name, depending on the requirements of the function. i.e. (fun2 "text" 123.4) or (fun3). The Command type does not have arguments passed to it, but may prompt the user for input instead. If a function name is preceded with "c:" and it has required arguments, it can only be run as a Function type enclosed in parentheses. In this case the "c:" is usually omitted.

 

AutoLISP functions may include Local and Global variables. Local variables are in memory while the function is running and are cleared when the function ends. Global variables are variables that are set and not declared as Local in a function. They remain in memory after the function ends and in the drawing environment until the drawing is closed.


The typical first line of a Command type function may look like one of the following:

(defun c:fun4 ( ) ; No Local variables declared.
(defun c:fun5 (/ cnt pt) ; Two Local variable are declared after the forward slash "/".

 

This is also how Local variables are declared in the Function type functions.
The typical first line of a Function type function may look like one of the following:

(defun fun6 ( ) ; No Arguments and no Local variables declared.
(defun fun7 (text num) ; Two Arguments and no Local variables declared.
(defun fun9 (/ cnt pt) ; Two Local variables declared after the forward slash "/".
(defun fun8 (text num / cnt pt) ; Two Arguments and two Local variables declared.

 

The forward slash "/" separates the arguments from the local variables. The code for a sub Function can be included within another Function. It may be declared Local by including its Function name in the list of Local variables as in the following example:

(defun fun10 (x y / ss fun11)
  (defun fun11 ( ) . . .

 

Both the Command types and the Function types can return a value, if the last line or the last segment of code can be evaluated. i.e. (setq xyz (c:fun12)) or (setq xyz (fun13))


In the above examples both c:fun12 and fun13 apparently have included a return value as the last line or the last segment of code. Typically only the Functions types are designed to return a value. To suppress the
nil echoed to the command line after running a Command type, include a (princ) as the last line of the function.

  Start  
     
   Menu  
   < Back  
   Next >  
     
  Introduction to Dialogs  

Dcl stands for Dialog Control Language. Dcl is a descriptive and interpretive language within AutoCAD. It’s generally controlled by AutoLISP functions to interact with the end user to gather information and data in the AutoCAD environment. The syntax of Dcl is based upon defining basic tiles. Tiles are the items or groups of items in a dialog, such as an edit_box or a radio_row. A dialog includes the dialog box and all of the tiles within it.

 

Similar to other languages that use parenthesis "()" to enclose functions and segments of code, Dcl uses curly braces "{}" as its method for enclosing dialog definitions and the properties and attributes of tiles. The syntax for attributes and values is separated by an equal sign "=" and ending with a semicolon ";". For example: attribute = value;

 

Dcl is an extremely case-sensitive language. All of the names within the syntax of the language must be lower case. The case of all labels and keys defined in the Dcl file by the programmer, must match the exact case of all calls from within AutoLISP to control and retrieve tile information. For example, a key named "Data_Box" can not be accessed using "data_BOX", as the case is not the same. Also note, that the text string for labels for keys may only contain letters, numbers, dashes and underscores.

 

As with AutoLISP, the Dcl filename may be different that any of the names of the dialog definitions within. If a dialog definition is copied or moved to another Dcl file, remember to change the call to load_dialog to the new Dcl filename within the AutoLISP function. Also, if a dialog definition is renamed, change the dialog name for the call to new_dialog as well.

 

Dcl provides a way of auditing during the design process and checking for errors. At audit_level = 3; Dcl provides the most comprehensive help and hints and finds redundant attribute information. If you are alerted to view the Acad.dce file for further information, use the included "Dce" function to view the file. You may include the following line in your Dcl file during the design and development stage to benefit from Dcl audit help and hints.

dcl_settings : default_dcl_settings { audit_level = 3; }

 

This is a brief introduction to Dcl dialogs. For further information refer to the related AutoCAD Help topics and books on the subject. There are also several websites that may provide additional information relating to Dcl Dialogs.

  Start  
     
   Menu  
   < Back  
   Next >  
     

 

My Dialogs Menu

   My Dialogs Menu
             
    My First     My Edit Text     My Back Next  
    My Alert 1     My Edit Boxes     My Pick Button  
    My Alert 2     My Popup Lists     My Slide Images  
    My Bold Text     My Other Lists     My Image Button  
    My Ok Cancel     My Multi Lists     My Sliders  
    My Yes No     My Radios     Dcl Calcs  
    My Next / My Back     My Toggles     View Dcl  
             
     

Start 

     
             
 
  Start  
     
   Menu  
   < Back  
   Next >  
     
My Dialogs Menu is designed with html links to quickly jump to other parts of the tutorial. The AutoLISP and Dialog version is very similar. It is included in the MyDialogs files, which may be downloaded and run along with the tutorial. Once you have loaded MyDialogs in AutoCAD, (load "MyDialogs"), simply type "My" to open the My Dialogs Menu.

 

My First

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
dcl_settings : default_dcl_settings { audit_level = 3; }
//---------------------------------------------------------------------------------------------------------
// MyFirst
//---------------------------------------------------------------------------------------------------------

MyFirst : dialog {
  label = " Hello World";
  spacer;
  : text {
    label = "This is my first dialog.";
    alignment = centered;
  }
  spacer;
  ok_only;
}
//MyFirst

;----------------------------------------------------------------------------------------------------------
; c:MyFirst - You've got to start somewhere
; Syntax: MyFirst
;----------------------------------------------------------------------------------------------------------
(defun c:MyFirst (/ Dcl_Id%)
  (princ "\nMyFirst")(princ)
 
; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyFirst" Dcl_Id%)
 
; Dialog Actions
  (start_dialog)
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (princ)

);defun c:MyFirst
 

My Alert 1

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
//---------------------------------------------------------------------------------------------------------
// MyAlert1
//---------------------------------------------------------------------------------------------------------
MyAlert1 : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  spacer;
  : text {
  key = "Text1";
  label = "";
//Message$ from lsp file
  width = 20.6;
  alignment = centered;
  }
  spacer;
  ok_only;
}
//MyAlert1
;----------------------------------------------------------------------------------------------------------
; MyAlert1 - Alert dialog with one message line
; Arguments: 2
; Title$ = Dialog Title
; Message$ = Message line
; Syntax: (MyAlert1 " My Message" "I'm going to figure this out.")
;----------------------------------------------------------------------------------------------------------
(defun MyAlert1 (Title$ Message$ / Dcl_Id%)
  (princ "\nMyAlert1")(princ)
 
; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyAlert1" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" Title$)
  (set_tile "Text1" Message$)
 
; Dialog Actions
  (start_dialog)
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (princ)
)
;defun MyAlert1
 

My Alert 2

  

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
//---------------------------------------------------------------------------------------------------------
// MyAlert2
// Note: Added key "Text2" tile and changed widths to 30.6 for example.
//---------------------------------------------------------------------------------------------------------
MyAlert2 : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  spacer;
  : text {
    key = "Text1";
    label = "";
//Message1$ from lsp file
    width = 30.6;
  }
  : text {
    key = "Text2";
    label = "";
//Message2$ from lsp file
    width = 30.6;
  }
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : ok_button {
      label = "OK";
      width = 8.59;
      is_cancel = true;
    }
    : button {
      key = "Help";
      label = "Help";
      width = 8.59;
      fixed_width = true;
    }
  }

}//MyAlert2
;----------------------------------------------------------------------------------------------------------
; MyAlert2 - Alert dialog with two message lines and a Help button
; Arguments: 3
; Title$ = Dialog Title
; Message1$ = Message line 1
; Message2$ = Message line 2
; Syntax: (MyAlert2 " Attention AutoCAD" "Not only am I going to figure this out,"
; "but I'm going to be good at it!")
;----------------------------------------------------------------------------------------------------------
(defun MyAlert2 (Title$ Message1$ Message2$ / Dcl_Id%)
  (princ "\nMyAlert2")(princ)
 
; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyAlert2" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" Title$)
  (set_tile "Text1" Message1$)
  (set_tile "Text2" Message2$)
 
; Dialog Actions
  (action_tile "Help" "(alert \"You don't need any help.\nYou're doing great!\")")
  (start_dialog)
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (princ)
)
;defun MyAlert2

 

My Bold Text

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

//---------------------------------------------------------------------------------------------------------
// MyBoldText
// Note: The widths were determined by the example and will need to be changed
// as per your requirements.
//---------------------------------------------------------------------------------------------------------
MyBoldText : dialog {
  label = " My Bold Text";
  spacer;
  : text {
    key = "Text1";
    label = "";
//Text1$ from lsp file
    width = 18;
    fixed_width_font = true;
  }
  : image {
    key = "ImageText2";
//ImageText2$ from lsp file
    width = 24;
    height = 1.28;
//Height is Ok per font
    fixed_width = true;
    fixed_height = true;
    aspect_ratio = 1;
    color = -15;
//-15 is dialog color
  }
  spacer;
  ok_only;
}
//MyBoldText

;----------------------------------------------------------------------------------------------------------
; c:MyBoldText - Two methods of displaying bold text
; Syntax: MyBoldText
;----------------------------------------------------------------------------------------------------------
(defun c:MyBoldText (/ Dcl_Id%)
  (princ "\nMyBoldText")(princ)
 
; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyBoldText" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Text1" "This is just text.")
  (set_tile "ImageText2" "This is image text.")
 
; Dialog Actions
  (start_dialog)
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (princ)
)
;defun c:MyBoldText

 

My Ok Cancel

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

//---------------------------------------------------------------------------------------------------------
// MyOkCancel
// Customize Ok Cancel buttons and group them together and specify their widths
//---------------------------------------------------------------------------------------------------------
MyOkCancel : dialog {
  label = " My Ok Cancel";
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : ok_button {
      width = 11;
    }
    : cancel_button {
      width = 11;
    }
  }
}
//MyOkCancel

;----------------------------------------------------------------------------------------------------------
; c:MyOkCancel - Customize Ok Cancel buttons and then princ the Return# you
; choose to associate with the buttons pressed.
; Syntax: MyOkCancel
;----------------------------------------------------------------------------------------------------------
(defun c:MyOkCancel (/ Dcl_Id% Return#)
  (princ "\nMyOkCancel")(princ)
 
; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyOkCancel" Dcl_Id%)
 
; Dialog Actions
  (action_tile "accept" "(done_dialog 1)");You can change the default Return#
  (action_tile "cancel" "(done_dialog 0)")
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (princ "\n")(princ Return#)
;Optional
  (princ)
)
;defun c:MyOkCancel

 

My Yes No

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

//---------------------------------------------------------------------------------------------------------
// MyYesNo
// Note: The width for the Text1 key was determined by the syntax example and
// will need to be changed as per your requirements. Also note that the buttons
// for Yes and No, the added fixed_width = true;.
//---------------------------------------------------------------------------------------------------------
MyYesNo : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  spacer;
  : text {
    key = "Text1";
    label = "";
//Question$ from lsp file
    width = 35.0;
    alignment = centered;
  }
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : button {
      key = "Yes";
      label = "&Yes";
      is_default = true;
      width = 7.92;
      fixed_width = true;
    }
    : button {
      key = "No";
      label = "&No";
      is_cancel = true;
      width = 7.92;
      fixed_width = true;
    }
  }
}
//MyYesNo

;----------------------------------------------------------------------------------------------------------
; MyYesNo - Question dialog with one question line
; Arguments: 2
;   Title$ = Dialog Title
;   Question$ = Question line
; Syntax: (MyYesNo " My Yes No" "Do you like creating programs in AutoLISP?")
;----------------------------------------------------------------------------------------------------------
(defun MyYesNo (Title$ Question$ / Answer$ Dcl_Id% Return#)
  (princ "\nMyYesNo")(princ)
 
; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyYesNo" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" Title$)
  (set_tile "Text1" Question$)
 
; Dialog Actions
  (action_tile "Yes" "(done_dialog 1)")
  (action_tile "No" "(done_dialog 0)")
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (if (= Return# 1)
    (setq Answer$ "Yes")
    (setq Answer$ "No")
  );if
  (princ "\n")(princ Answer$)(princ)
;Optional
  Answer$
)
;defun MyYesNo

 

My Next / My Back

  

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

//---------------------------------------------------------------------------------------------------------
// MyNext
//---------------------------------------------------------------------------------------------------------
MyNext : dialog {
  label = " My Next";
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : button {
      key = "Next";
      is_default = true;
      label = "&Next >";
      width = 11;
      fixed_width = true;
    }
    : cancel_button {
      width = 11;
    }
  }
}
//MyNext

;----------------------------------------------------------------------------------------------------------
; c:MyNext - Provides a way to goto the next dialog using the done_dialog Return#
; method. This will be covered again in the function c:MyBackNext, after we cover
; other tiles and how to save the dialog tiles information in a gobal variable
; list for later use.
; Syntax: MyNext
;----------------------------------------------------------------------------------------------------------
(defun c:MyNext (/ Dcl_Id% Return#)
  (princ "\nMyNext")(princ)
 
; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyNext" Dcl_Id%)
 
; Dialog Actions
  (action_tile "Next" "(done_dialog 1)")
  (action_tile "cancel" "(done_dialog 0)")
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (if (= Return# 1)
    (c:MyBack)
  )
;if
  (princ)
)
;defun c:MyNext
//---------------------------------------------------------------------------------------------------------
// MyBack
//---------------------------------------------------------------------------------------------------------
MyBack : dialog {
  label = " My Back";
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : button {
      key = "Back";
      is_default = true;
      label = "< &Back";
      width = 11;
      fixed_width = true;
    }
    : cancel_button {
      width = 11;
    }
  }
}
//MyBack

;----------------------------------------------------------------------------------------------------------
; c:MyBack - Provides a way to go back to a previous dialog using the done_dialog
; Return# method. This will be covered again in the function c:MyBackNext, after
; we cover other tiles and how to save the dialog tiles information in a gobal
; variable list for later use.
; Syntax: MyBack
;----------------------------------------------------------------------------------------------------------
(defun c:MyBack (/ Dcl_Id% Return#)
  (princ "\nMyBack")(princ)
 
; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyBack" Dcl_Id%)
 
; Dialog Actions
  (action_tile "Back" "(done_dialog 1)")
  (action_tile "cancel" "(done_dialog 0)")
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (if (= Return# 1)
    (c:MyNext)
  )
;if
  (princ)
)
;defun c:MyBack

 

My Edit Text

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

//---------------------------------------------------------------------------------------------------------
// MyEditText
//---------------------------------------------------------------------------------------------------------
MyEditText : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  initial_focus = "Edit1";
  spacer;
  : row {
    : column {
      width = 5.09;
      fixed_width = true;
      spacer;
      : text {
        key = "Prompt";
        label = "";
//Prompt from lsp file
      }
    }
    : edit_box {
      key = "Edit1";
//Edit1$ from lsp file
      edit_width = 26.42;
      fixed_width = true;
    }
  }
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : ok_button {
      width = 11;
    }
    : cancel_button {
      width = 11;
    }
  }
}
//MyEditText

;----------------------------------------------------------------------------------------------------------
; MyEditText - Dialog to edit text
; Arguments: 2
;   Title$ = Dialog Title
;   Edit1$ = Text to edit
; Syntax: (MyEditText " My Edit Text" "")
;----------------------------------------------------------------------------------------------------------
(defun MyEditText (Title$ Edit1$ / Dcl_Id% NewText$ Return#)
  (princ "\nMyEditText")(princ)
 
; Set Default Variables
  (setq NewText$ Edit1$)
 
; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyEditText" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" Title$)
  (set_tile "Prompt" "Text:")
  (set_tile "Edit1" Edit1$)
 
; Dialog Actions
  (action_tile "accept" "(setq NewText$ (get_tile \"Edit1\"))(done_dialog 1)")
  (action_tile "cancel" "(done_dialog 0)")
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (if (= Return# 0) (setq NewText$ nil))
  NewText$
)
;defun MyEditText

 

My Edit Boxes

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

//---------------------------------------------------------------------------------------------------------
// MyEditBoxes
//---------------------------------------------------------------------------------------------------------
MyEditBoxes : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  initial_focus = "Edit1";
  spacer;
  : row {
//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text1";
        label = "";
//Text1$ from lsp file
      }
    }
    : edit_box {
      key = "Edit1";
//Edit1$ from lsp file
      edit_width = 9.42;
      fixed_width = true;
    }
  }
//>
  : row {//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text2";
        label = "";
//Text2$ from lsp file
      }
    }
    : edit_box {
      key = "Edit2";
//Edit2$ from lsp file
      edit_width = 9.42;
      fixed_width = true;
    }
  }
//>
  : row {//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text3";
        label = "";
//Text3$ from lsp file
      }
    }
    : edit_box {
      key = "Edit3";
//Edit3$ from lsp file
      edit_width = 9.42;
      fixed_width = true;
    }
  }
//>
  spacer;
  ok_only;

}//MyEditBoxes

;----------------------------------------------------------------------------------------------------------
; c:MyEditBoxes - Dialog to edit text, integers, and real numbers
; Syntax: MyEditBoxes
;----------------------------------------------------------------------------------------------------------

(defun c:MyEditBoxes (/ Dcl_Id% Edit1$ Edit2$ Edit3$ Return#)
  (princ "\nMyEditBoxes")(princ)
 
; Set Default Variables
  (if (not *MyEditBoxes@);Unique global variable name to store dialog info
    (setq *MyEditBoxes@ (list nil "" "" ""))
  )
;if
  (setq Edit1$ (nth 1 *MyEditBoxes@)
        Edit2$ (nth 2 *MyEditBoxes@)
        Edit3$ (nth 3 *MyEditBoxes@)
  )
;setq
  ; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyEditBoxes" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My Edit Boxes")
  (set_tile "Text1" "Enter First Name")
  (set_tile "Edit1" Edit1$)
  (set_tile "Text2" "Enter your Age")
  (set_tile "Edit2" Edit2$)
  (set_tile "Text3" "Enter a Real Number")
  (set_tile "Edit3" Edit3$)
 
; Dialog Actions
  (action_tile "Edit1" "(setq Edit1$ $value)")
  (action_tile "Edit2" "(check_editint \"Edit2$\")")
;*Included
  (action_tile "Edit3" "(check_editreal \"Edit3$\")");*Included
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (setq *MyEditBoxes@ (list nil Edit1$ Edit2$ Edit3$))
  (princ)
)
;defun c:MyEditBoxes

 

My Popup Lists

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

//---------------------------------------------------------------------------------------------------------
// MyPopupLists
//---------------------------------------------------------------------------------------------------------
MyPopupLists : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  initial_focus = "List1";
  spacer;
  : row {
//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text1";
        label = "";
//Text1$ from lsp file
      }
    }
    : popup_list {
      key = "List1";
//Value1$ from lsp file
      width = 11.42;
      fixed_width = true;
    }
  }
//>
  : row {//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text2";
        label = "";
//Text2$ from lsp file
      }
    }
    : popup_list {
      key = "List2";
//Value2$ from lsp file
      width = 11.42;
      fixed_width = true;
    }
  }
//>
  spacer;
  ok_only;

}//MyPopupLists

;----------------------------------------------------------------------------------------------------------
; c:MyPopupLists - Dialog to select choices from popup lists
; Syntax: MyPopupLists
;----------------------------------------------------------------------------------------------------------

(defun c:MyPopupLists (/ Dcl_Id% List1@ List2@ Return# Value1$ Value2$)
  (princ "\nMyPopupLists")(princ)
 
; Set Default Variables
  (if (not *MyPopupLists@);Unique global variable name to store dialog info
    (setq *MyPopupLists@ (list nil "" ""))
  )
;if
  (setq Value1$ (nth 1 *MyPopupLists@)
        Value2$ (nth 2 *MyPopupLists@)
        List1@ (list "" "Red" "Orange" "Yellow" "Green" "Cyan" "Blue" "Magenta")
        List2@ (list "" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
  )
;setq
  ; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyPopupLists" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My Popup Lists")
  (set_tile "Text1" "My Favorite Color")
  (set_tile_list "List1" List1@ Value1$)
;*Included
  (set_tile "Text2" "My Favorite Number")
  (set_tile_list "List2" List2@ Value2$)
;*Included
  ; Dialog Actions
  (action_tile "List1" "(set_list_value \"List1@\" \"Value1$\")");*Included
  (action_tile "List2" "(set_list_value \"List2@\" \"Value2$\")");*Included
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (setq *MyPopupLists@ (list nil Value1$ Value2$))
  (princ)

);defun c:MyPopupLists

 

My Other Lists

  

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

//---------------------------------------------------------------------------------------------------------
// MyOtherLists
//---------------------------------------------------------------------------------------------------------
MyOtherLists : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  initial_focus = "List1";
  spacer;
  : row {
//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text1";
        label = "";
//Text1$ from lsp file
      }
    }
    : popup_list {
      key = "List1";
//Value1$ from lsp file
      width = 11.42;
      fixed_width = true;
    }
  }
//>
  : row {//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text2";
        label = "";
//Text2$ from lsp file
      }
    }
    : popup_list {
      key = "List2";
//Value2$ from lsp file
      width = 11.42;
      fixed_width = true;
    }
  }
//>
  : row {//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text3";
        label = "";
//Text3$ from lsp file
      }
    }
    : popup_list {
      key = "List3";
//Value3$ from lsp file
      width = 11.42;
      fixed_width = true;
    }
  }
//>
  spacer;
  ok_only;

}//MyOtherLists

;----------------------------------------------------------------------------------------------------------
; c:MyOtherLists - Dialog to select or add other choices from popup lists,
; including text lists, integer lists, and real number lists.
; Syntax: MyOtherLists
;----------------------------------------------------------------------------------------------------------

(defun c:MyOtherLists (/ Dcl_Id% List1@ List2@ List3@ Return# Value1$ Value2$ Value3$)
  (princ "\nMyOtherLists")(princ)
 
; Set Default Variables
  (if (not *MyOtherLists@);Unique global variable name to store dialog info
    (setq *MyOtherLists@ (list nil "" "" ""))
  )
;if
  (setq Value1$ (nth 1 *MyOtherLists@)
        Value2$ (nth 2 *MyOtherLists@)
        Value3$ (nth 3 *MyOtherLists@)
;For list with Other add "" and "Other" to end
        List1@ (list "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "" "Other")
        List2@ (list "1950" "1960" "1970" "1980" "1990" "2000" "" "Other")
        List3@ (list "1.1" "2.2" "3.3" "4.4" "5.5" "6.6" "7.7" "8.8" "9.9" "" "Other")
  )
;setq
  (if (not (member Value1$ List1@));Add item if not a member of list
    (setq List1@ (insert_nth (- (length List1@) 2) Value1$ List1@))
  )
;if
  (if (not (member Value2$ List2@));Add item if not a member of list
    (setq List2@ (insert_nth (- (length List2@) 2) Value2$ List2@))
  )
;if
  (if (not (member Value3$ List3@));Add item if not a member of list
    (setq List3@ (insert_nth (- (length List3@) 2) Value3$ List3@))
  )
;if
  ; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyOtherLists" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My Other Lists")
  (set_tile "Text1" "My Favorite Day")
  (set_tile_list "List1" List1@ Value1$)
;*Included
  (set_tile "Text2" "My Favorite Decade")
  (set_tile_list "List2" List2@ Value2$)
;*Included
  (set_tile "Text3" "My Favorite Real Number")
  (set_tile_list "List3" List3@ Value3$)
;*Included
 
; Dialog Actions
  (action_tile "List1" "(set_other_list \"List1@\" \"Value1$\")");*Included
  (action_tile "List2" "(set_other_intlist \"List2@\" \"Value2$\")");*Included
  (action_tile "List3" "(set_other_reallist \"List3@\" \"Value3$\")");*Included
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (setq *MyOtherLists@ (list nil Value1$ Value2$ Value3$))
  (princ)

);defun c:MyOtherLists

 

My Multi Lists

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

//---------------------------------------------------------------------------------------------------------
// MyMultiLists
//---------------------------------------------------------------------------------------------------------
MyMultiLists : dialog {
  key = "Title";
  label = "";
  : boxed_column {
    label = "Select an Item";
    : list_box {
      key = "List1";
//Value1$ from lsp file
      height = 6.27;
      fixed_height = true;
      width = 32.92;
      fixed_width = true;
    }
    spacer;
  }
  : boxed_column {
    label = "Multi Select Items";
    : list_box {
      multiple_select = true;
      key = "List2";
//Value2$ from lsp file
      height = 6.27;
      fixed_height = true;
      width = 32.92;
      fixed_width = true;
    }
    spacer;
  }
  spacer;
  ok_only;
}
//MyMultiLists

;----------------------------------------------------------------------------------------------------------
; c:MyMultiLists - Dialog for list_boxes with single and multi select examples
; Syntax: MyMultiLists
;----------------------------------------------------------------------------------------------------------
(defun c:MyMultiLists (/ Dcl_Id% List1@ List2@ Return# Value1$ Value2$)
  (princ "\nMyMultiLists")(princ)
 
; Set Default Variables
  (if (not *MyMultiLists@);Unique global variable name to store dialog info
    (setq *MyMultiLists@ (list nil "" ""))
  )
;if
  (setq Value1$ (nth 1 *MyMultiLists@)
        Value2$ (nth 2 *MyMultiLists@)
        List1@ (list "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday")
        List2@ (list "January" "February" "March" "April" "May" "June" "July" "August"
                     "September" "October" "November" "December")
  )
;setq
  ; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyMultiLists" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My Multi Lists")
  (set_tile_list "List1" List1@ Value1$)
;*Included
  (set_tile_list "List2" List2@ Value2$)
;*Included
 
; Dialog Actions
  (action_tile "List1" "(set_list_value \"List1@\" \"Value1$\")");*Included
  (action_tile "List2" "(set_multilist_value \"List2@\" \"Value2$\")");*Included
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (setq *MyMultiLists@ (list nil Value1$ Value2$))
  (princ)
)
;defun c:MyMultiLists

 

My Radios

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

//---------------------------------------------------------------------------------------------------------
// MyRadios
//---------------------------------------------------------------------------------------------------------
MyRadios : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  spacer;
  : boxed_radio_row {
    key = "Radio1";
    label = "Paper Size";
    width = 34.26;
    fixed_width = true;
    : radio_button {
      key = "A";
      label = "A-Size";
    }
    : radio_button {
      key = "B";
      label = "B-Size";
    }
    : radio_button {
      key = "C";
      label = "C-Size";
    }
  }
  : boxed_radio_column {
    key = "Radio2";
    label = "Orientation";
    : radio_button {
      key = "P";
      label = "Portrait";
    }
    : radio_button {
      key = "L";
      label = "Landscape";
    }
  }
  spacer;
  ok_only;

}//MyRadios

;----------------------------------------------------------------------------------------------------------
; c:MyRadios - Dialog with radio_rows and radio_columns
; Syntax: MyRadios
;----------------------------------------------------------------------------------------------------------
(defun c:MyRadios (/ Dcl_Id% Radio1$ Radio2$ Return#)
  (princ "\nMyRadios")(princ)
 
; Set Default Variables
  (if (not *MyRadios@);Unique global variable name to store dialog info
    (setq *MyRadios@ (list nil "" ""))
  )
;if
  (setq Radio1$ (nth 1 *MyRadios@)
        Radio2$ (nth 2 *MyRadios@)
  )
;setq
  ; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyRadios" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My Radios")
  (set_tile "Radio1" Radio1$)
  (set_tile "Radio2" Radio2$)
 
; Dialog Actions
  (action_tile "Radio1" "(setq Radio1$ $value)")
  (action_tile "Radio2" "(setq Radio2$ $value)")
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (setq *MyRadios@ (list nil Radio1$ Radio2$))
  (princ)

);defun c:MyRadios

 

My Toggles

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
//---------------------------------------------------------------------------------------------------------
// MyToggles
//---------------------------------------------------------------------------------------------------------
MyToggles : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  spacer;
  : boxed_column {
    label = "Row of Toggles";
    width = 34.26;
    fixed_width = true;
    : row {
      : toggle {
        key = "Toggle1";
        label = "Toggle 1";
      }
      : toggle {
        key = "Toggle2";
        label = "Toggle 2";
      }
    }
    spacer;
  }
  : boxed_column {
    label = "Column of Toggles";
    width = 34.26;
    fixed_width = true;
    : toggle {
      key = "Toggle3";
      label = "Toggle 3";
    }
    : toggle {
      key = "Toggle4";
      label = "Toggle 4";
    }
    : toggle {
      key = "Toggle5";
      label = "Toggle 5";
    }
    spacer;
  }
  spacer;
  ok_only;

}//MyToggles

;----------------------------------------------------------------------------------------------------------
; c:MyToggles - Dialog with toggles arranged in a row and a column
; Syntax: MyToggles
;----------------------------------------------------------------------------------------------------------

(defun c:MyToggles (/ Dcl_Id% Toggle1$ Toggle2$ Toggle3$ Toggle4$ Toggle5$ Return#)
  (princ "\nMyToggles")(princ)
 
; Set Default Variables
  (if (not *MyToggles@);Unique global variable name to store dialog info
    (setq *MyToggles@ (list nil "0" "0" "0" "0" "0"))
  )
;if
  (setq Toggle1$ (nth 1 *MyToggles@)
        Toggle2$ (nth 2 *MyToggles@)
        Toggle3$ (nth 3 *MyToggles@)
        Toggle4$ (nth 4 *MyToggles@)
        Toggle5$ (nth 5 *MyToggles@)
  )
;setq
  ; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyToggles" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My Toggles")
  (set_tile "Toggle1" Toggle1$)
  (set_tile "Toggle2" Toggle2$)
  (set_tile "Toggle3" Toggle3$)
  (set_tile "Toggle4" Toggle4$)
  (set_tile "Toggle5" Toggle5$)
 
; Dialog Actions
  (action_tile "Toggle1" "(setq Toggle1$ $value)")
  (action_tile "Toggle2" "(setq Toggle2$ $value)")
  (action_tile "Toggle3" "(setq Toggle3$ $value)")
  (action_tile "Toggle4" "(setq Toggle4$ $value)")
  (action_tile "Toggle5" "(setq Toggle5$ $value)")
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (setq *MyToggles@ (list nil Toggle1$ Toggle2$ Toggle3$ Toggle4$ Toggle5$))
  (princ)

);defun c:MyToggles

 

My Back Next 1 of 3

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
;----------------------------------------------------------------------------------------------------------
; c:MyBackNext - This function demonstrates the method for going back or to the
; next dialog in a series, utilizing the global dialog variable lists to save
; the information. This function starts with the first dialog MyEdit_Lists,
; which cycles through MyList_Radios and MyEdit_Toggles.
; Syntax: MyBackNext
;----------------------------------------------------------------------------------------------------------

(defun c:MyBackNext (/ Text$)
  (princ "\nMyBackNext")(princ)
  ;========================================================================================================
  ; Get data from other Global dialog lists that apply for the demo.
  ; Note: This section between the double lines is not required.
  (if (not *MyEdit_Lists@)
    (progn
      (setq *MyEdit_Lists@ (list nil "" ""))
      (if *MyEditBoxes@
        (setq *MyEdit_Lists@ (change_nth 1 (nth 1 *MyEditBoxes@) *MyEdit_Lists@))
;*Included
      );if
      (if *MyPopupLists@
        (setq *MyEdit_Lists@ (change_nth 2 (nth 1 *MyPopupLists@) *MyEdit_Lists@))
;*Included
      );if
    );progn
  );if
  (if (not *MyList_Radios@)
    (progn
      (setq *MyList_Radios@ (list nil "" ""))
      (if *MyPopupLists@
        (setq *MyList_Radios@ (change_nth 1 (nth 2 *MyPopupLists@) *MyList_Radios@))
;*Included
      );if
      (if *MyRadios@
        (setq *MyList_Radios@ (change_nth 2 (nth 1 *MyRadios@) *MyList_Radios@))
;*Included
      );if
    );progn
  );if
  ;========================================================================================================
  ; Start with first dialog MyEdit_Lists
  (MyEdit_Lists)
  (setq Text$ "\nYour favorite software is ")
  (cond
    ((and (= (nth 2 *MyEdit_Toggles@) "1")(= (nth 3 *MyEdit_Toggles@) "1"))
      (setq Text$ (strcat Text$ "AutoCAD and Excel."))
    )
;case
    ((= (nth 2 *MyEdit_Toggles@) "1")
      (setq Text$ (strcat Text$ "AutoCAD."))
    )
;case
    ((= (nth 3 *MyEdit_Toggles@) "1")
      (setq Text$ (strcat Text$ "Excel."))
    )
;case
    (t (setq Text$ ""))
  )
;cond
  (alert (strcat (nth 1 *MyEdit_Lists@) " " (nth 1 *MyEdit_Toggles@);Your name
    "\nYour favorite color is " (nth 2 *MyEdit_Lists@) "."
    "\nYour favorite number is " (nth 1 *MyList_Radios@) "."
    "\nYour favorite paper size is " (nth 2 *MyList_Radios@) "-Size."
    Text$)
  )
;alert
);defun c:MyBackNext

//---------------------------------------------------------------------------------------------------------
// MyEdit_Lists
//---------------------------------------------------------------------------------------------------------
MyEdit_Lists : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  initial_focus = "Edit1";
  spacer;
  : row {
//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text1";
        label = "";
//Text1$ from lsp file
      }
    }
    : edit_box {
      key = "Edit1";
//Edit1$ from lsp file
      edit_width = 9.42;
      fixed_width = true;
    }
  }
//>
  : row {//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text2";
        label = "";
//Text2$ from lsp file
      }
    }
    : popup_list {
      key = "List2";
//Value2$ from lsp file
      width = 11.42;
      fixed_width = true;
    }
  }
//>
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : button {
      key = "Next";
      is_default = true;
      label = "&Next >";
      width = 11;
      fixed_width = true;
    }
    : cancel_button {
      width = 11;
    }
  }

}//MyEdit_Lists

;----------------------------------------------------------------------------------------------------------
; MyEdit_Lists - Dialog edit and list examples for c:MyBackNext
; Syntax: (MyEdit_Lists)
;----------------------------------------------------------------------------------------------------------

(defun MyEdit_Lists (/ Dcl_Id% Edit1$ List2@ Return# Value2$ Verify_Info:)
  (princ "\nMyEdit_Lists")(princ)
 
; Verify_Info: ------------------------------------------------------------------------------------------
  (defun Verify_Info: (/ Passed)
    (setq Passed t)
    (foreach Item *MyEdit_Lists@
      (if (= Item "") (setq Passed nil))
    )
;foreach
    (if (not Passed)
      (progn
        (alert "All information is required to be completed!")
        (MyEdit_Lists)
      )
;progn
    );if
  );defun Verify_Info:
  ;--------------------------------------------------------------------------------------------------------
  ; Set Default Variables
  (if (not *MyEdit_Lists@);Unique global variable name to store dialog info
    (setq *MyEdit_Lists@ (list nil "" ""))
  )
;if
  (setq Edit1$ (nth 1 *MyEdit_Lists@)
        Value2$ (nth 2 *MyEdit_Lists@)
        List2@ (list "" "Red" "Orange" "Yellow" "Green" "Cyan" "Blue" "Magenta")
  )
;setq
  ; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyEdit_Lists" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My Edit & List Tiles")
  (set_tile "Text1" "Enter First Name")
  (set_tile "Edit1" Edit1$)
  (set_tile "Text2" "My Favorite Color")
  (set_tile_list "List2" List2@ Value2$)
;*Included
  ; Dialog Actions
  (action_tile "Edit1" "(setq Edit1$ $value)")
  (action_tile "List2" "(set_list_value \"List2@\" \"Value2$\")")
;*Included
  (action_tile "Next" "(done_dialog 1)")
  (action_tile "cancel" "(done_dialog 0)")
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (if (= Return# 0) (exit))
  (setq *MyEdit_Lists@ (list Return# Edit1$ Value2$))
  (if (= Return# 1) (Verify_Info:))
;Next
  (if (= Return# 1) (MyList_Radios));Next
  (princ)
);defun MyEdit_Lists

 

My Back Next 2 of 3

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
//---------------------------------------------------------------------------------------------------------
// MyList_Radios
//---------------------------------------------------------------------------------------------------------
MyList_Radios : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  initial_focus = "Edit1";
  spacer;
  : row {
//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text1";
        label = "";
//Text1$ from lsp file
      }
    }
    : popup_list {
      key = "List1";
//Value1$ from lsp file
      width = 11.42;
      fixed_width = true;
    }
  }
//>
  spacer;
  : boxed_radio_row {
    key = "Radio2";
    label = "Favorite Paper Size";
    width = 34.26;
    fixed_width = true;
    : radio_button {
      key = "A";
      label = "A-Size";
    }
    : radio_button {
      key = "B";
      label = "B-Size";
    }
    : radio_button {
      key = "C";
      label = "C-Size";
    }
  }
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : button {
      key = "Back";
      label = "< &Back";
      width = 11;
    }
    : button {
      key = "Next";
      is_default = true;
      label = "&Next >";
      width = 11;
    }
    : cancel_button {
      width = 11;
    }
  }

}//MyList_Radios

;----------------------------------------------------------------------------------------------------------
; MyList_Radios - Dialog list and radio examples for c:MyBackNext
; Syntax: (MyList_Radios)
;----------------------------------------------------------------------------------------------------------

(defun MyList_Radios (/ Dcl_Id% List1@ Return# Value1$ Radio2$ Verify_Info:)
  (princ "\nMyList_Radios")(princ)
 
; Verify_Info: ------------------------------------------------------------------------------------------
  (defun Verify_Info: (/ Passed)
    (setq Passed t)
    (foreach Item *MyList_Radios@
      (if (= Item "") (setq Passed nil))
    )
;foreach
    (if (not Passed)
      (progn
        (alert "All information is required to be completed!")
        (MyList_Radios)
      )
;progn
    );if
  );defun Verify_Info:
  ;--------------------------------------------------------------------------------------------------------
  ; Set Default Variables
  (if (not *MyList_Radios@);Unique global variable name to store dialog info
    (setq *MyList_Radios@ (list nil "" ""))
  )
;if
  (setq Value1$ (nth 1 *MyList_Radios@)
        Radio2$ (nth 2 *MyList_Radios@)
        List1@ (list "" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
  )
;setq
  ; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyList_Radios" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My List & Radio Tiles")
  (set_tile "Text1" "My Favorite Number")
  (set_tile_list "List1" List1@ Value1$)
;*Included
  (set_tile "Radio2" Radio2$)
 
; Dialog Actions
  (action_tile "List1" "(set_list_value \"List1@\" \"Value1$\")");*Included
  (action_tile "Radio2" "(setq Radio2$ $value)")
  (action_tile "Back" "(done_dialog 2)")
  (action_tile "Next" "(done_dialog 1)")
  (action_tile "cancel" "(done_dialog 0)")
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (if (= Return# 0) (exit))
  (setq *MyList_Radios@ (list Return# Value1$ Radio2$))
  (if (= Return# 1) (Verify_Info:))
;Next
  (if (= Return# 1) (MyEdit_Toggles));Next
  (if (= Return# 2) (MyEdit_Lists));Back
  (princ)
);defun MyList_Radios

 

My Back Next 3 of 3

  

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
//---------------------------------------------------------------------------------------------------------
// MyEdit_Toggles
//---------------------------------------------------------------------------------------------------------
MyEdit_Toggles : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  initial_focus = "Edit1";
  spacer;
  : row {
//<
    fixed_width = true;
    : column {
      width = 24.76;
      fixed_width = true;
      spacer;
      : text {
        key = "Text1";
        label = "";
//Text1$ from lsp file
      }
    }
    : edit_box {
      key = "Edit1";
//Edit1$ from lsp file
      edit_width = 9.42;
      fixed_width = true;
    }
  }
//>
  spacer;
  : boxed_column {
    label = "Favorite Software";
    width = 34.26;
    fixed_width = true;
    : row {
      : toggle {
        key = "Toggle2";
        label = "AutoCAD";
      }
      : toggle {
        key = "Toggle3";
        label = "Excel";
      }
    }
    spacer;
  }
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : button {
      key = "Back";
      label = "< &Back";
      width = 11;
    }
    : ok_button {
      width = 11;
    }
    : cancel_button {
      width = 11;
    }
  }

}//MyEdit_Toggles

;----------------------------------------------------------------------------------------------------------
; MyEdit_Toggles - Dialog edit and toggle examples for c:MyBackNext
; Syntax: (MyEdit_Toggles)
;----------------------------------------------------------------------------------------------------------

(defun MyEdit_Toggles (/ Dcl_Id% Edit1$ Return# Toggle2$ Toggle3$ Verify_Info:)
  (princ "\nMyEdit_Toggles")(princ)
 
; Verify_Info: ------------------------------------------------------------------------------------------
  (defun Verify_Info: (/ Passed)
    (setq Passed t)
    (foreach Item *MyEdit_Toggles@
      (if (= Item "") (setq Passed nil))
    )
;foreach
    (if (not Passed)
      (progn
        (alert "All information is required to be completed!")
        (MyEdit_Toggles)
      )
;progn
    );if
  );defun Verify_Info:
  ;--------------------------------------------------------------------------------------------------------
  ; Set Default Variables
  (if (not *MyEdit_Toggles@);Unique global variable name to store dialog info
    (setq *MyEdit_Toggles@ (list nil "" "0" "0"))
  )
;if
  (setq Edit1$ (nth 1 *MyEdit_Toggles@)
        Toggle2$ (nth 2 *MyEdit_Toggles@)
        Toggle3$ (nth 3 *MyEdit_Toggles@)
  )
;setq
  ; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyEdit_Toggles" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My Edit & Toggle Tiles")
  (set_tile "Text1" "Enter Last Name")
  (set_tile "Edit1" Edit1$)
  (set_tile "Toggle2" Toggle2$)
  (set_tile "Toggle3" Toggle3$)
 
; Dialog Actions
  (action_tile "Edit1" "(setq Edit1$ $value)")
  (action_tile "Toggle2" "(setq Toggle2$ $value)")
  (action_tile "Toggle3" "(setq Toggle3$ $value)")
  (action_tile "Back" "(done_dialog 2)")
  (action_tile "accept" "(done_dialog 1)")
  (action_tile "cancel" "(done_dialog 0)")
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (if (= Return# 0) (exit))
  (setq *MyEdit_Toggles@ (list Return# Edit1$ Toggle2$ Toggle3$))
  (if (= Return# 1) (Verify_Info:))
;OK
  (if (= Return# 2) (MyList_Radios));Back
  (princ)
);defun MyEdit_Toggles

 

My Pick Button

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
//---------------------------------------------------------------------------------------------------------
// MyPickButton
//---------------------------------------------------------------------------------------------------------
MyPickButton : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  spacer;
  : row {
    : column {
      fixed_width = true;
      : row {
        : column {
          spacer;
          : image_button {
            key = "select_pick";
            width = 3.59;
            height = 1.66;
            fixed_width = true;
            fixed_height = true;
            aspect_ratio = 1;
            color = -15;
          }
          spacer;
        }
        : column {
          spacer;
          : text {
            key = "Prompt";
            label = "";
            width = 31.09;
            fixed_width = true;
            vertical_margin = none;
          }
          spacer;
        }
      }
    }
  }
  : boxed_column {
    label = "Object Information";
    width = 34.26;
    fixed_width = true;
    : paragraph {
      : text_part {
        key = "Text1";
        label = "";
//Text1$ from lsp file
      }
      : text_part {
        key = "Text2";
        label = "";
//Text2$ from lsp file
      }
      : text_part {
        key = "Text3";
        label = "";
//Text3$ from lsp file
      }
    }
    spacer;
  }
  spacer;
  ok_only;

}//MyPickButton

;----------------------------------------------------------------------------------------------------------
; c:MyPickButton - Dialog example for hiding a dialog and picking an object and
; returning the information of the object selected.
; Syntax: MyPickButton
;----------------------------------------------------------------------------------------------------------

(defun c:MyPickButton (/ Dcl_Id% EntIns$ EntLayer$ EntList@ EntName^ EntPick@
  EntType$ EntXpt$ EntYpt$ Found Item Return# Text1$ Text2$ Text3$)
  (princ "\nMyPickButton")(princ)
 
; Set Default Variables
  (if (not *MyPickButton@)
;Unique global variable name to store dialog info
    (setq *MyPickButton@ (list nil "" "" ""))
  )
;if
 
; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (setq Return# 2)
  (while (/= Return# 1)
    (new_dialog "MyPickButton" Dcl_Id%)
   
; Set Variables and Dialog Initial Settings
    (setq Text1$ (nth 1 *MyPickButton@)
          Text2$ (nth 2 *MyPickButton@)
          Text3$ (nth 3 *MyPickButton@)
    )
;setq
    (set_tile "Title" " My Pick Button")
    (select_pick)
;*Included
    (set_tile "Prompt" "Select an object")
    (set_tile "Text1" Text1$)
    (set_tile "Text2" Text2$)
    (set_tile "Text3" Text3$)
   
; Dialog Actions
    (action_tile "select_pick" "(done_dialog 2)")
    (action_tile "accept" "(done_dialog 1)")
    (setq Return# (start_dialog))
    (if (= Return# 2)
      (if (setq EntPick@ (entsel))
        (progn
          (setq EntName^ (car EntPick@)
                EntList@ (entget EntName^)
                EntType$ (cdr (assoc 0 EntList@))
                EntLayer$ (cdr (assoc 8 EntList@))
                EntXpt$ (rtos (nth 1 (assoc 10 EntList@)) 2 3)
                EntYpt$ (rtos (nth 2 (assoc 10 EntList@)) 2 3)
                EntIns$ (strcat EntXpt$ "," EntYpt$)
                Found t
          )
;setq
          (setq *MyPickButton@ (list Found
                   (strcat "Object Type: " EntType$)
                   (strcat "Object Layer: " EntLayer$)
                   (strcat "Insertion point: " EntIns$))
          )
;setq
          (foreach Item EntList@
            (princ "\n")(princ Item)
          )
;foreach
          (princ "\n")
        )
;progn
        (progn
          (setq Found (nth 0 *MyPickButton@))
          (setq *MyPickButton@ (list Found "" "\t    No object selected" ""))
          (setq EntList@ nil)
        )
;progn
      )
;if
    )
;if
  )
;while
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (if (nth 0 *MyPickButton@)
    (textscr)
  )
;if
  (setq *MyPickButton@ (list nil "" "" ""))
  (princ)
)
;defun c:MyPickButton

 

My Slide Images

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
//---------------------------------------------------------------------------------------------------------
// MySlideImages
//---------------------------------------------------------------------------------------------------------
MySlideImages : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  spacer;
  : row {
    : image_button {
      key = "Slide1";
      width = 17.26;
      height = 5.28;
      aspect_ratio = 1;
      color = -2;
    }
    : image_button {
      key = "Slide2";
      width = 17.26;
      height = 5.28;
      aspect_ratio = 1;
      color = -2;
    }
  }
  : row {
    : column {
      : text {
        key = "Text1";
        label = "";
//Text1$ from lsp file
        width = 17.26;
        fixed_width = true;
        alignment = centered;
      }
    }
    : column {
      : text {
        key = "Text2";
        label = "";
//Text2$ from lsp file
        width = 17.26;
        fixed_width = true;
        alignment = centered;
      }
    }
  }
  : row {
    : image_button {
      key = "Slide3";
      width = 17.26;
      height = 5.28;
      aspect_ratio = 1;
      color = -2;
    }
    : image_button {
      key = "Slide4";
      width = 17.26;
      height = 5.28;
      aspect_ratio = 1;
      color = -2;
    }
  }
  : row {
    : column {
      : text {
        key = "Text3";
        label = "";
//Text3$ from lsp file
        width = 17.26;
        fixed_width = true;
        alignment = centered;
      }
    }
    : column {
      : text {
        key = "Text4";
        label = "";
//Text4$ from lsp file
        width = 17.26;
        fixed_width = true;
        alignment = centered;
      }
    }
  }
  ok_only;

}//MySlideImages
 
;----------------------------------------------------------------------------------------------------------
; c:MySlideImages - Dialog of four slides for example. For the demo create four
; slides and modify the Slides@ list variable. Edit the Folder$ variable to the
; path and folder where the new slides are stored. i.e. "C:\\Slds\\". This is
; the basics for creating your own block slide library.
; Syntax: MySlideImages
;----------------------------------------------------------------------------------------------------------

(defun c:MySlideImages (/ Dcl_Id% Folder$ Slides@ Slide1$ Slide2$ Slide3$ Slide4$
  Return$ X# Y#)
  (princ "\nMySlideImages")(princ)
 
; Set Default Variables
  (setq Slides@ (list nil "Bolt_Top" "Nut_Washer" "Nut_Top" "Nut")
        Slide1$ (nth 1 Slides@)
        Slide2$ (nth 2 Slides@)
        Slide3$ (nth 3 Slides@)
        Slide4$ (nth 4 Slides@)
        Folder$ ""
        Return$ ""
  );setq
 
; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MySlideImages" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My Slide Images")
  (set_tile "Text1" Slide1$)
  (set_tile "Text2" Slide2$)
  (set_tile "Text3" Slide3$)
  (set_tile "Text4" Slide4$)
 
; Adjust X# and Y# per image_buttom outline to fit slide_image
  (start_image "Slide1")(setq X# (- (dimx_tile "Slide1") 2))
  (setq Y# (- (dimy_tile "Slide1") 2))(end_image)
  (start_image "Slide1")(slide_image 1 1 X# Y# (strcat Folder$ Slide1$))(end_image)
  (start_image "Slide2")(slide_image 1 1 X# Y# (strcat Folder$ Slide2$))(end_image)
  (start_image "Slide3")(slide_image 1 1 X# Y# (strcat Folder$ Slide3$))(end_image)
  (start_image "Slide4")(slide_image 1 1 X# Y# (strcat Folder$ Slide4$))(end_image)
 
; Dialog Actions
  (action_tile "Slide1" "(setq Return$ Slide1$)")
  (action_tile "Slide2" "(setq Return$ Slide2$)")
  (action_tile "Slide3" "(setq Return$ Slide3$)")
  (action_tile "Slide4" "(setq Return$ Slide4$)")
  (start_dialog)
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (princ (strcat "\n" Return$))
  (princ)

);defun c:MySlideImages

 

My Image Button

  

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
//---------------------------------------------------------------------------------------------------------
// MyImageButton
//---------------------------------------------------------------------------------------------------------
MyImageButton : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  spacer;
  : image_button {
    key = "Image1";
    width = 35.92;
    height = 16.59;
    fixed_width = true;
    fixed_height = true;
    aspect_ratio = 1;
    color = -2;
  }
  : text {
    key = "Text1";
    label = "";
//Text1$ from lsp file
    width = 23.42;
    fixed_width = true;
    alignment = centered;
  }
  ok_only;
}
//MyImageButton

;----------------------------------------------------------------------------------------------------------
; c:MyImageButton
; These images were created using GetVectors.lsp on AutoLISP Exchange
; (URL: https://autolisp-exchange.com)
;----------------------------------------------------------------------------------------------------------

(defun c:MyImageButton (/ Dcl_Id% Show_Image:)
  (princ "\nMyImageButton")(princ)
 
; Show_Image: -------------------------------------------------------------------------------------------
  (defun Show_Image: (/ Ang CenPt Dist~ PickPt X# Y#)
    (start_image "Image1")(setq X# (dimx_tile "Image1"))
    (setq Y# (dimy_tile "Image1"))(end_image)
    ((setq CenPt (list (/ X# 2)(/ Y# 2))
          PickPt (list $x $y)
          Ang (angle CenPt PickPt)
          Dist~ (distance CenPt PickPt)
    )
;setq
    (cond
      ((< Dist~ (/ Y# 4))(Front_View))
;*Included
      ((< Ang (dtr 45))(Right_View))
;*Included
      ((< Ang (dtr 135))(Bottom_View))
;*Included
      ((< Ang (dtr 225))(Left_View))
;*Included
      ((< Ang (dtr 315))(Top_View))
;*Included
      (t (Right_View))
    )
;cond
  );defun Show_Image:
  ;--------------------------------------------------------------------------------------------------------
  ; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MyImageButton" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My Image Button")
  (set_tile "Text1" "Pick arrows to change views.")
  (Front_View)
;*Included
 
; Dialog Actions
  (action_tile "Image1" "(Show_Image:)")
  (start_dialog)
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (princ)

);defun c:MyImageButton

 

My Sliders

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
//---------------------------------------------------------------------------------------------------------
// MySliders
//---------------------------------------------------------------------------------------------------------
MySliders : dialog {
  key = "Title";
  label = "";
//Title$ from lsp file
  spacer;
  : row {
    : image {
      key = "ColorImage";
      width = 18.26;
      height = 8.43;
      fixed_width = true;
      fixed_height = true;
      aspect_ratio = 1;
    }
    : slider {
      layout = vertical;
      key = "SliderV";
      min_value = 1;
      max_value = 6;
      small_increment = 1;
      big_increment = 2;
      height = 8.43;
      fixed_height = true;
      is_tab_stop = false;
    }
  }
  : row {
    height = 1.97;
    : slider {
      key = "SliderH";
      min_value = 1;
      max_value = 6;
      small_increment = 1;
      big_increment = 2;
      width = 18.26;
      fixed_width = true;
      is_tab_stop = false;
    }
  }
  : paragraph {
    : text_part {
      key = "Text1";
      label = "";
//Text1$ from lsp file
    }
    : text_part {
      key = "Text2";
      label = "";
//Text2$ from lsp file
    }
    : text_part {
      key = "Text3";
      label = "";
//Text3$ from lsp file
    }
  }
  ok_only;
}
//MySliders

;----------------------------------------------------------------------------------------------------------
; c:MySliders
; Syntax: MySliders
;----------------------------------------------------------------------------------------------------------

(defun c:MySliders (/ Cnt# Color# Colors@ Dcl_Id% FillinColor: List@ Return#
  SliderH$ SliderV$)
  (princ "\nMySliders")(princ)
 
; FillinColor: ------------------------------------------------------------------------------------------
  (defun FillinColor: (/ X# Y#)
    (setq Color# (nth (1- (atoi SliderV$)) (nth (1- (atoi SliderH$)) Colors@)))
    (start_image "ColorImage")
   
; The drawing area is 1 less than dimx_tile and dimy_tile returns
    (setq X# (1- (dimx_tile "ColorImage")))
    (setq Y# (1- (dimy_tile "ColorImage")))
   
; Outline image
    (vector_image 0 0 X# 0 255);Top white
    (vector_image 0 0 0 Y# 255)
;Left white
    (vector_image X# 0 X# Y# 250)
;Right black
    (vector_image 0 Y# X# Y# 250)
;Bottom Black
   
; Fillin only the inside
    (fill_image 1 1 (1- X#) (1- Y#) Color#)
    (end_image)
    (set_tile "Text1" (strcat "Horizontal = " SliderH$))
    (set_tile "Text2" (strcat "Vertical = " SliderV$))
    (set_tile "Text3" (strcat "Color = " (itoa Color#)))
  )
;defun FillinColor:
  ;--------------------------------------------------------------------------------------------------------
  ; Set Default Variables
  (if (not *MySliders@);Unique global variable name to store dialog info
    (setq *MySliders@ (list nil "1" "1" 15))
  )
;if
  (setq Colors@ (list (list 15 13 11 10 12 14)))
  (setq Cnt# 1)
  (repeat 5
    (setq List@ nil)
    (foreach Item (nth (1- Cnt#) Colors@)
      (setq List@ (append List@ (list (+ Item 40))))
    )
;foreach
    (setq Colors@ (append Colors@ (list List@)))
    (setq Cnt# (1+ Cnt#))
  )
;repeat
  (setq SliderH$ (nth 1 *MySliders@)
        SliderV$ (nth 2 *MySliders@)
        Color# (nth (1- (atoi SliderV$)) (nth (1- (atoi SliderH$)) Colors@))
  )
;setq
  ; Load Dialog
  (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
  (new_dialog "MySliders" Dcl_Id%)
 
; Set Dialog Initial Settings
  (set_tile "Title" " My Sliders")
  (FillinColor:)
  (set_tile "SliderH" SliderH$)
  (set_tile "SliderV" SliderV$)
  (set_tile "Text1" (strcat "Horizontal = " SliderH$))
  (set_tile "Text2" (strcat "Vertical = " SliderV$))
  (set_tile "Text3" (strcat "Color = " (itoa Color#)))
 
; Dialog Actions
  (action_tile "SliderH" "(setq SliderH$ $value)(FillinColor:)")
  (action_tile "SliderV" "(setq SliderV$ $value)(FillinColor:)")
  (setq Return# (start_dialog))
 
; Unload Dialog
  (unload_dialog Dcl_Id%)
  (setq *MySliders@ (list nil SliderH$ SliderV$ Color#))
  (princ)

);defun c:MySliders

 

Dcl Calcs

  

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
Dcl Calcs is a utility program for calculating the widths and heights of Dialog tiles.

In the Images and Tiles section, the values of the X Pixels and Y Pixels correspond to the return of the dimx_tile and dimy_tile variables in image tiles. The algorithm to determine the values in this section may also be used to calculate the width and height of other type of tiles as well. The change in other tiles may not relate to Pixels, but as incremental changes instead.

In the Text and Tile Widths section, the widths are calculated based upon the longest phrase needed. This section is very useful for aligning a column of text with popup_list and edit_box tiles. This method ignores the hard coded dcl labels for popup_list and edit_box tiles, and provides a dynamic alternative of being able to change the text labels within AutoLISP.

The toggles for Popup List and Edit Box determine the combination of choices that will be used in a column. If only one toggle is selected, it calculates the needed width per the longest phrase needed. If both toggles are selected, it recalculates the widths to align both types in a column. Also notice that the Text Column width for the Edit Box is equivalent to one pixel greater than the Text Column width for the Popup List.

In the List Box Tiles section, enter the desired number of lines to display in a list_box tile and the corresponding height is displayed. If the number of lines is one of the ones that are skipped in dcl, it will display a message with all of the skipped lines within a reasonable range.

The Calculator image button runs the Windows calculator, which is handy for doing some calculations while still in the dialog.

 

View Dcl

  

 
  Start  
     
   Menu  
   < Back  
   Next >  
     
ViewDcl is a very useful utility for viewing dialogs within dcl files, as you are designing them or just need to view or compare other dialogs. If this type of utility is not part or your preferred AutoLISP and Dialog editor, it is a great utility to have. It can be run on the command line without loading any editor.

GetIcon ShowIcons

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

GetIcon is a great utility to add to your library of dialog functions. After loading GetIcon, (load "GetIcon"), type "GetIcon" and "GetButtons" to view the syntax of the main functions. They’re very easy to understand and use. You can have up to 10 message lines, by separating the lines in the message argument with the "\n" symbol. This is also the symbol you would use in the alert function to start a new line. For example: "One\nTwo\nThree\nFour". The dialog is created on the fly to fit all of the lines of text and combinations of buttons. To view the available icons, as in the dialog above, type "ShowIcons". You may also add your own 32x32 pixel icons to be used by GetIcon and GetButtons. To make your icons compatible, name your icon image function ending with a colon ":", and use the same name in lower case without the colon to name the image tile. For example: (defun MyIcon:()(start_image "myicon")...

 

Here is a method for creating icon images for those who are new to the subject. Draw a rectangle from "0,0" to "32,-32". The upper left corner of an image tile is "0,0", and you will later convert the negative points to positive when entering the code. Zoom in on the extents of the rectangle. Turn your snap to 1, as the vector_image function only allows integer values. The dialog image created by GetIcon has a width = 5.42; and a height = 2.51;. This returns a 33 dimx_tile and a 33 dimy_tile pixel value. Your available drawing area is one less than the return of these values.

 

For your choice of colors, you can create layer names with the colors you will be using, or just change the color of the polylines as you draw your image. Color 250 for black and color 255 for white, work best on most AutoCAD background screen configurations without extra programming. Color 7 for white will be black if the users’ background screen configuration is inverted.

 

Dialog images have two main drawing tools, fill_image for solids and vector_image for lines. The syntax for fill_image is: (fill_image starting-x starting-y across down color). The arguments for "across" and "down" signify the total number of pixels to be filled across and down. The fill_image drawing tool is very useful for filling in rectangular solids or for changing the background color of the image tile. For example: (fill_image 0 0 (dimx_tile "myicon")(dimy_tile "myicon") 5), would change the image background to color 5 blue.

 

The most common drawing tool is the vector_image for lines. The syntax for vector_image is: (vector_image starting-x starting-y ending-x ending-y color). To start drawing your icon image, use a polyline with a starting and ending width of 0.75. For single pixel points use a donut with an inside diameter of 0 and an outside diameter or 0.75. This leaves a small gap between objects for when you need to list them for their x and y coordinates. One thing to remember is that you are drawing objects on a grid. It’s sort of like drawing on a chess board. In chess you know the movement of a knight. In Dcl the placement of the step in between may be unpredictable. To insure your desired placement, draw two polylines to achieve the results required. Arcs and circles are not part of the dialog image drawing tools. For arcs you will have to trace an arc with the snap set to 1. For circles you can trace a polygon with enough sides to simulate a circle with the snap set to 1.

 

After you have perfected your icon image in AutoCAD, the next step is creating the code for your image. Consider the drawing order as you are entering your code. Typically the fill_image solids are entered before the vector_image lines, but this is not always the case. You will convert the negative points to positive as you are entering your code. There are three basic ways to determine the locations of the icon image points. The easiest method is to turn your coords and snap on and move the mouse to the points needed. Another method is to use the ID command to find the points, and still another method is to LIST the objects. The LIST command also helps show you the color and layer of the object. The following example creates a white rectangle with a red X in the upper left corner and an outline of the rectangle.

My Icon

 
  Start  
     
   Menu  
   < Back  
   Next >  
     

(defun MyIcon:()

  (start_image "myicon")

  ; Fill image from 5,7 across 23 and down 19 with color 255 white

  (fill_image 5 7 23 19 255);White rectangle

  ; Draw a X from 7,9 to 13,15 and from 7,15 to 12,9 with color 1 red

  (vector_image 7 9 13 15 1)(vector_image 7 15 12 9 1);Red X

  ; Draw a light outline from 4,26 to 4,6 and from 4,6 to 28,6 with color 9 light grey

  (vector_image 4 26 4 6 9)(vector_image 4 6 28 6 9);Upper and left light outline

  ; Draw a darker outline from 28,6 to 28,26 and from 28,26 to 4,26 with color 8 darker grey

  (vector_image 28 6 28 26 8)(vector_image 28 26 4 26 8);Lower and right darker outline

  (end_image)

);defun MyIcon:

 

To test your icon, simply type the following:

(GetOk "Hello World" "This is my first icon!" "myicon")

GetIcon & GetButtons

   GetIcon & GetButtons
     
   Get Icon & Get Buttons  
   Get Icon.lsp  
     

Select Options

 
  Start  
     
   Menu  
   < Back