amcdicsac 发表于 2022-7-5 17:53:04

我需要帮助我使用Popup\u

嗨,我有个问题:
我在一个“弹出列表”中准备了几个,我希望每次你选择其中一个列表时,这些列表的内容都看起来像一个“列表框”
 
;;;---------------------------------------- setvar --------------------------
(defun saveVars()
(setq blkList (list))
(setq ignlist (get_tile "bloqlist"))
(setq count 1)   
(while (setq fila (read ignlist))
   (setq blkList (append blkList (list (nth fila bloList))))
   (while
   (and
       (/= " " (substr ignlist count 1))
       (/= ""(substr ignlist count 1)))
   (setq count (1+ count)))
   (setq ignlist (substr ignlist count))))

;;;---------------------------------------- read file "1-DWG-TOMACORRIENTES.txt" for default --------------------------
(defun blokinf ()
(setq bloList (list))   
(if (findfile "1-DWG-TOMACORRIENTES.txt")
(progn
(if (setq ruta (open (findfile "C:/Program Files/AutoCAD 2008/1-DWG-TOMACORRIENTES.txt") "r"))
(progn      
(read-line ruta)
(while (setq pa (read-line ruta))         
(setq bloList         
(append
bloList
(list (list pa)))))
(close ruta))))) bloList )


;;;---------------------------------------- main program --------------------------
(defun c:E1 ( / bloqlist$ infolist$)
(if (not *E1@) (setq *E1@ (list nill "" "")))
(setq bloqlist$ (nth 1 *E1@))
(setq infolist$ (nth 2 *E1@))
(setvar "cmdecho" 0)
(setq bloList (blokinf))   
(if bloList   
(progn
(setq dcl_id (load_dialog "INSERT-1.dcl"))      
(if (not (new_dialog "INSERTA" dcl_id "" (cond (*screenpointE1*) ('(-1 -1)))))      
(progn
(princ "\n**ERROR**") (exit)))       
(setq bloNames (list))   
(foreach pa bloList
(setq bloNames (append bloNames(list (car pa)))))

(setq folder (GetDwgsMob "AutoCAD 2008")) ;;add version autocad to folder

;;;;(_addlist "bloqlist" bloNames)

(_addlist "infolist" folder)

(set_tile "bloqlist" bloqlist$)
(set_tile "infolist" infolist$)
(action_tile "bloqlist" "(setq bloqlist$ $value)")
(action_tile "infolist" "(start_list \"bloqlist\") (mapcar 'add_list (eval (read (strcat \"1-DWG-\" $value \".TXT\")))) (end_list)")
(action_tile "cancel" "(setq *screenpointE1* (done_dialog 1))")
(action_tile "accept" "(saveVars)(setq *screenpointE1* (done_dialog 2))")
(setq ddiag (start_dialog))
(unload_dialog dcl_id)
(setq *E1@ (list nil bloqlist$ infolist$))
(if (= ddiag 1) (prompt "\n**Cancel**"))
(princ))))

;;----------------- Path-2DAMobBasico ------------------------------------
;; main route ---> "C:/Program Files/"
;;------------------------------------------------------------------------

(defun Path-2DAMobBasico () "C:/Program Files/")

;;------------------------ GetDwgsMob ------------------------------------------------------------------
;; collects data from the specified directory(setq folder (GetDwgsMob "AutoCAD 2008"))
;; return ---> "C:/Program Files/AutoCAD 2008/"
;;------------------------------------------------------------------------------------------------------
(defun GetDwgsMob (sParentMob / ListaMob DirMobTipo)         
    (if (setq DirMobTipo (strcat (Path-2DAMobBasico) sParentMob))
   (setq ListaMob (vl-directory-files (strcat DirMobTipo "\\") "*.txt" 1)
      ListaMob (mapcar (function vl-filename-base) ListaMob))   
    );c.if
    ListaMob
   );c.defun

(defun _addlist ( key lst )
       (start_list key)
       (foreach x lst (add_list x))
       (end_list)
       lst)

 
INSERTA : dialog { label = "Program.....";
         initial_focus="bloqlist";
         : column {
         spacer_1;
         : boxed_row { label = "content of each list"; alignment = centered;
          spacer_1;
          : list_box { key = "bloqlist"; allow_accept = true; fixed_width = true; width = 40; value = "0";}
      }
         spacer_1;
         }
      spacer_1;
        : popup_list { width =40; key = "infolist"; value = "1"; is_enabled = true ; }
        spacer_1;
        : row {
        : button { key = "accept";label = "accept"; is_default = true;width =14;}
          : button { key = "cancel";label = "cancel"; is_default = false; is_cancel = true;width =14;}
           }
}

 
页: [1]
查看完整版本: 我需要帮助我使用Popup\u