;; | ---------------------------------------------------------------------------- ;; | DL_SelectProperty ;; | ---------------------------------------------------------------------------- ;; | Function : Pop up a dialog box to select an item from a list of strings ;; | Arguments : ;; | 'Lst' - List of Strings ;; | 'dflt' - Default Value, overloaded, can be either a string or ;; | list ;; | 'Sort' - Boolean flag to indicate if Sorting is to be done ;; | 'MultSel' - If T, allow multiple select else allow only single ;; | select. ;; | Updated : June 22, 1999 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun DL_SelectProperty ( Lst dflt Sort MultSel title / retVal tmpStr val tmp _Lst tmp1 tmp2 len pos dfltStr dfltLst ) (if MultSel (progn (if (not (new_dialog "list_items_mult_dlg" #dcl_id)) (exit) ) ) (progn (if (not (new_dialog "list_items_sing_dlg" #dcl_id)) (exit) ) )) (if (and Sort Lst) (setq Lst (acad_strlsort Lst)) ) (set_tile "dlg_title" title) (DL_FillLst Lst "items") (if dflt (progn (if (listp dflt) (setq dfltStr (LI_Lst2Str dflt ",")) (setq dfltStr dflt) ) (setq dfltStr (strcase dfltStr) dfltLst (ST_StrTok dfltStr (list ",")) _Lst (mapcar 'strcase Lst) len (length Lst) tmp "" ) (foreach tmp1 dfltLst (if (setq tmp2 (member tmp1 _Lst)) (setq tmp (strcat tmp (itoa (- len (length tmp2))) " ")) ) ) (set_tile "items" tmp) )) (action_tile "items" "(setq tmp $Value)") (action_tile "accept" "(done_dialog 100)") (action_tile "cancel" "(done_dialog 99)") (setq retVal (start_dialog) tmpStr nil ) (if (= retVal 100) (progn (if tmp (progn (setq tmp (mapcar 'atoi (ST_Str2Lst tmp " ")) tmpStr "" ) (foreach val tmp (setq tmpStr (strcat tmpStr "," (nth val Lst))) ) (if (= (substr tmpStr 1 1) ",") (setq tmpstr (substr tmpStr 2)) ) ; The statements below are to fix a bug reported by ; Andrew Truckle which is manifested only on his computer (if (not MultSel) (progn (setq pos (ST_fsrch tmpStr ",")) (if pos (setq tmpStr (substr tmpStr 1 (1- pos))) ) )) )) )) tmpStr )