Hey all,
I am trying to find my way in DCL forms.
so far I have managed to put something together with the help of information on afralisp and an example from Lee Mac.
i have multiple problems
in the dcl, i would like to get the label above the text field
i can set a default for the color
I can't get back the chosen values when I restart the routine for the part .
for the code to work you have to upload lee mac - ListTileDependencyV1-1.lsp
found at his website -
http://www.lee-mac.com/listtiledependency.html;; Two List Tile Dependency Example - Lee Mac
;; Requires ListTileDependency.lsp to be loaded.
(defun c:test1_a5 ( / *error* dch dcl des lst )
;; rtn
;;; end subroutine
(defun *error* ( msg )
(if (= 'file (type des))
(close des)
)
(if (< 0 dch)
(unload_dialog dch)
)
(if (and (= 'str (type dcl)) (findfile dcl))
(vl-file-delete dcl)
)
(if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
(princ (strcat "\nError: " msg))
)
(princ)
)
;;;
(setq lst
'(
("German"
("Audi" ("TTS Quattro" "TT RS" "S3 Quattro" "S4 Quattro" ))
("BMW" ("M3" "M5" "M6" "X5" "Z3" "Z4"))
("Porsche" ("911" "924" "928" "930" "944" "Boxster" "Cayenne" "Cayman"))
)
("English"
("Jaguar" ("XF" "XJ6" "XJR" "XKR" "X-Type" "S-Type"))
("Bentley" ("Cintinental" "Flying Spur" "Mulliner" "Bentayga" ))
)
)
)
;; list colr
(setq lst-Color (list "Blue" "Red"))
;;; end lists
; Set Default Variables
(if (not *MyPopupLists@);Unique global variable name to store dialog info
(setq *MyPopupLists@ (list nil "" ""))
);if
;(setq lst-color-value (nth 1 tmp.dcl))
(if
(and
(setq dcl (vl-filename-mktemp "tmp.dcl"))
(setq des (open dcl "w"))
(foreach str
'(
"lbx : list_box"
"{"
" alignment = centered;"
" fixed_width = true;"
" fixed_height = true;"
" width = 20;"
" height = 15;"
"}"
;;
"ebx : edit_box"
"{"
" fixed_width = true;"
;; key = "Edit1";//Edit1$ from lsp file
" width = 20;"
"}"
;;
"test : dialog"
"{"
" label = \"List Box Dependency Example\";"
" spacer;"
" : row"
" {"
" : lbx { key = \"lb1\"; label = \"List Box 1\"; }"
" : ebx { key = \"ebx2\"; label = \"text box 2\"; }"
" : lbx { key = \"lb3\"; label = \"List Box 3\"; }"
" : lbx { key = \"lb4\"; label = \"List Box 4\"; }"
" : lbx { key = \"lb5\"; label = \"List Box 5\"; }"
" }"
" spacer;"
" ok_cancel;"
"}"
)
(write-line str des)
)
(not (setq des (close des)))
(< 0 (setq dch (load_dialog dcl)))
(new_dialog "test" dch)
)
(progn
;; if there was a choice
;; return
(if rtn
(setq rtn rtn)
(setq rtn '(0 0 0))
)
;; color
(if color-2
(setq color-in color-2)
(setq color-in 0)
)
;; number-ok
(if number
(setq number (rtos (fix number)))
(setq number "12345")
);
(LM:dcld:action '("lb3" "lb4" "lb5") 'lst 'rtn)
;; add the lst-Color
;;(set_tile "lb1" color-in)
(start_list "lb1") ;start the list box
(mapcar 'add_list lst-Color) ;fill the list box
(end_list) ;end list
;; add the text field -nummer
(set_tile "ebx2" number) ; value
(action_tile "eb1" ;is user enters
"(ebox_action $value $reason)") ;pass arguments to ebox_action
;;;;;;
(action_tile
"accept" ;if O.K. pressed
(strcat ;string 'em together
"(progn
(setq return (LM:dcld:getitems rtn lst))
(setq Color (atof (get_tile \"lb1\")))" ;get list selection
"(setq lngth (atof (get_tile \"ebx2\")))" ;get slot length
" (done_dialog)(setq userclick T))" ;close dialog, set flag
);strcat
);action tile
(if (= 1 (start_dialog))
;; als is oke
(progn
;(setq return (LM:dcld:getitems rtn lst))
); end progn - als is oke
(princ "\n*Cancel*")
); end if dialog
); end progn
); end if
(progn
;;; (setq return (LM:dcld:getitems rtn lst))
;(setq SIZ-1 (atof (get_tile "lb1")))
(setq color-2 (fix color)) ;convert to integer
(setq color-3 (nth color-2 lst-Color)) ;get the size
(setq number (fix lngth))
); end progn - als is oke
(*error* nil)
(princ)
)