satishrajdev 发表于 2022-7-6 06:14:17

Popup\u列表

大家好,
 
我有一个问题如下。
 
我有一个发布的DCL&LISP,其中包含DCL中的popup\u list函数。
 
当我选择一个数字时。它通过在princ中显示choosen数来给出正确的结果。
 
当我再次运行相同的路由时,我希望在我上次从列表中选择的弹出列表中突出显示一个数字。
但它显示了列表的默认起始编号。
 
 
e、 如果我第一次选择7。
再次运行lisp。弹出窗口显示默认的1个数字。
我希望它是7。。。。正如我上次选择的那样
 
以下是DCL:-
CCL : dialog {
   label = "TEST" ;
   alignment = centered;
spacer;

: row {
: text {
label = "CHOOSE NUMBER :";
}
: popup_list {
key = "LIST1";
width = 7;
fixed_width = true;
}
}

spacer;

: row {
   : ok_button {
   width = 11;
   }
   : cancel_button {
   width = 11;
   }
}
}
 
这是Lisp:-
(DEFUN C:TEST ()

(setq LIST1@ '("1" "2" "3" "4" "5" "6" "7" "8"))

(setq dcl_id (load_dialog "TEST.DCL"))
(if (not (new_dialog "CCL" dcl_id))
   (exit)
)

(start_list "LIST1")
(mapcar 'add_list LIST1@)
(end_list)

(action_tile
   "accept"
   (strcat
   "(Progn
(setq LIST1 (atof (get_tile \"LIST1\")))"
   "(done_dialog)(setq userclick T))"
   )
)
(action_tile "cancel" "(done_dialog) (setq userclick nil)")

(start_dialog)

(unload_dialog dcl_id)

(if userclick
   (progn
   (setq LIST1 (fix LIST1))
   (setq LIST1 (nth LIST1 LIST1@))
   )
)
(PRINC (STRCAT "Number Choosen = " LIST1))
(PRINC)
)
 
请引导我。。。。。
 
谢谢
 
当做
萨提什语

Lee Mac 发表于 2022-7-6 06:24:40

考虑以下代码:
 
DCL:

ccl : dialog
{
   label = "Test";
   spacer;
   : popup_list
   {
       key = "lst";
       width = 7;
       fixed_width = true;
       label = "CHOOSE NUMBER:";
   }
   spacer; ok_cancel;
}
LISP:

(defun c:test ( / id lst )

   (setq lst '("1" "2" "3" "4" "5" "6" "7" "8"))

   (if
       (and
         (< 0 (setq id (load_dialog "test.dcl")))
         (new_dialog "ccl" id)
       )
       (progn
         (start_list "lst")
         (foreach itm lst (add_list itm))
         (end_list)
         (set_tile "lst" (cond (*num*) ((setq *num* "0"))))

         (action_tile "lst" "(setq *num* $value)")
         (if (= 1 (start_dialog))
               (princ (strcat "\nYou chose number: " (nth (atoi *num*) lst)))
         )
       )
       (princ "\nUnable to load dialog.")
   )
   (if (< 0 id) (unload_dialog id))
   (princ)
)

satishrajdev 发表于 2022-7-6 06:37:09

以下是一些简要说明:
(start_list "lst")
(foreach itm lst (add_list itm))
(end_list)
(set_tile "lst" (cond (*num*) ((setq *num* "0"))))
 
我建议研究功能:
 
start\u列表
添加_列表
end_列表
set_平铺

Lee Mac 发表于 2022-7-6 06:45:42

非常感谢,先生。。。。。
 
获得了一些有用的知识。。。。我将研究您指出的函数。。。。。如果我还有任何疑问,我会回来的。

satishrajdev 发表于 2022-7-6 06:54:32

不客气satishrajdev

Lee Mac 发表于 2022-7-6 07:04:48

satishrajdev 发表于 2022-7-6 07:11:01

Thanks a lot Sir.....
 
Got some useful knowledge.... I'll study the functions which you have pointed out..... And will come back if i got any further doubts.

Lee Mac 发表于 2022-7-6 07:19:02

You're welcome satishrajdev
页: [1]
查看完整版本: Popup\u列表