Writing DCL can be a bit of a task but one way around this is by writing a library routine that can be used over multiple programs. So here is an example called getvals it allows you via 1 line in your code to instantly make a dialouge box and you do not have to worry about coding. Other universal ones are a list dialouge to allow pick from a selection of items.
Code:
; Input Dialog box with variable title
; multiple lines of dcl supported
; add extra lines if required by copying code defun
; By Alan H 2015
; example code just use these next two lines
; (if (not AH:getval1)(load "getvals.lsp"))
; (ah:getval1 "Enter size " 5 4) ;
; 1 line dcl
; sample code (ah:getval1 "line 1" 5 4)
(defun AH:getval1 (title width limit / fo)
; you can hard code a directory if you like for dcl file
(setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval : dialog {" fo)
(write-line " : row {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat " key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line (strcat " label = " (chr 34) title (chr 34) ";" ) fo)
; these can be replaced with shorter value etc
(write-line (strcat " edit_width = " (rtos width 2 0) ";" ) fo)
(write-line (strcat " edit_limit = " (rtos limit 2 0) ";" ) fo)
(write-line " is_enabled = true;" fo)
(write-line " }" fo)
(write-line " }" fo)
(write-line "ok_only;}" fo)
(close fo)
(setq dcl_id (load_dialog fname))
(if (not (new_dialog "ddgetval" dcl_id))
(exit))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key1" 3)
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 as a string
) ; defungetval1
; 2 line dcl
; sample code
; (if (not AH:getval2)(load "getvals.lsp"))
; (ah:getval2 "line 1" 5 4 "line2" 8 7)
(defun AH:getval2 (title1 width1 limit1 title2 width2 limit2 / fo)
(setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval2 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat " key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line (strcat " label = " (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat " edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat " edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line " is_enabled = true ;" fo)
(write-line " }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat " key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = " (chr 34) title2 (chr 34) ";" ) fo)
(write-line (strcat " edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat " edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line " is_enabled = true ;" fo)
(write-line " }" fo)
(write-line " }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog fname))
(if (not (new_dialog "ddgetval2" dcl_id))
(exit))
(mode_tile "key1" 3)
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(action_tile "key2" "(setq val2 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 and val2 as strings
) ; defungetval2
; 3 line dcl
; sample code
;(if (not AH:getval3)(load "getvals.lsp"))
;(ah:getval3 "line 1" 5 4 "line2" 8 7 "line3" 6 4)
(defun AH:getval3 (title1 width1 limit1 title2 width2 limit2 title3 width3 limit3 / fo)
(setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval3 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat " key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line (strcat " label = " (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat " edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat " edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line " is_enabled = true ;" fo)
(write-line " }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat " key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = " (chr 34) title2 (chr 34) ";" ) fo)
(write-line (strcat " edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat " edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line " is_enabled = true ;" fo)
(write-line " }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat " key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = " (chr 34) title3 (chr 34) ";" ) fo)
(write-line (strcat " edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat " edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line " is_enabled = true ;" fo)
(write-line " }" fo)
(write-line " }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)
; code part
(setq dcl_id (load_dialog fname))
(if (not (new_dialog "ddgetval3" dcl_id))
(exit))
(mode_tile "key1" 3)
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(action_tile "key3" "(setq val3 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 and val2 val3 as strings
) ; defungetval3