乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 19|回复: 19

[编程交流] DCL - Popup_list

[复制链接]

56

主题

259

帖子

213

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
270
发表于 2022-7-5 20:11:47 | 显示全部楼层 |阅读模式
Hi,
 
I am trying to input more then 1 list in a popup list according to the radio button selected.
 
rigth not I was only able to make 1 appear.
 
Can some guide me in the right direction please.
 
Cheers
 
here are the codes : TEST.lsp
TEST.dcl
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 20:17:11 | 显示全部楼层
You will need to include the operations that are used to populate the popup_list tile within the action_tile statement, so that the operations are performed when the tile value is modified.
 
I would suggest something using this approach:
  1. (defun c:test ( / i id lst )   (setq lst      '(           ("rb1" " " "[m] Mètre" "[km] Kilomètre" "[pi] Pied" "[po] Pouce")           ("rb2" " " "[km²] Kilomètre carrée" "[m²] Mètre carrée" "[pi²] Pied carrée" "[po²] Pouce carrée")       )   )   (if (and (< 0 (setq id (load_dialog "test.dcl"))) (new_dialog "bienvenue" id))       (progn           (repeat (setq i 7)               (action_tile (strcat "rb" (itoa i))                    (strcat                       "(addlist "list_1" (cdr (assoc $key lst)))"                       "(addlist "list_2" (cdr (assoc $key lst)))"                   )               )               (setq i (1- i))           )           (start_dialog)       )   )   (if (< 0 id) (unload_dialog id))   (princ))(defun addlist ( key lst )   (start_list key)   (foreach x lst (add_list x))   (end_list)   lst)
(The above is untested)
回复

使用道具 举报

91

主题

428

帖子

326

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
474
发表于 2022-7-5 20:20:03 | 显示全部楼层
CadFrank,
change your code as follows:
 
  1. (defun c:test (/ _test Id)(defun _test (typ) (cond  ((= Typ "Long")   (start_list "list_1")   (mapcar 'add_list longueur1)   (end_list)   (start_list "list_2")   (mapcar 'add_list longueur1)   (end_list)  )  ((= Typ "Surf")   (start_list "list_1")   (mapcar 'add_list surface1)   (end_list)   (start_list "list_2")   (mapcar 'add_list surface1)   (end_list)  ) ))(setq longueur1 '(" " "[m] Mètre" "[km] Kilomètre" "[pi] Pied" "[po] Pouce"))(setq surface1 '(" " "[km²] Kilomètre carrée" "[m²] Mètre carrée" "[pi²] Pied carrée" "[po²] Pouce carrée"))(setq Id (load_dialog "X:\\Documents\\AutoCAD\\Support\\TEST.dcl"))(if (not (new_dialog "bienvenue" Id)) (exit))(action_tile "rb1" "(_test "Long")")(action_tile "rb2" "(_test "Surf")")(action_tile "rb3" "(_test "Vol")")(action_tile "rb4" "(_test "Poid")")(action_tile "rb5" "(_test "Force")")(action_tile "rb6" "(_test "Pres")")(action_tile "rb7" "(_test "Mom")")(action_tile "Close" "(done_dialog) (setq userclick nil)")(start_dialog)(unload_dialog id) (princ))
回复

使用道具 举报

91

主题

428

帖子

326

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
474
发表于 2022-7-5 20:23:12 | 显示全部楼层
It was very marvelous,
I think Lee sent his reply seconds before me.
回复

使用道具 举报

56

主题

259

帖子

213

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
270
发表于 2022-7-5 20:25:12 | 显示全部楼层
 
Well I think you understood what I wanted to do.
 
Hope I can understand the code. Thanks Lee.
 
and also Thanks to Ahankhah. Ill look up your code to !
 
Cheers !
回复

使用道具 举报

56

主题

259

帖子

213

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
270
发表于 2022-7-5 20:29:35 | 显示全部楼层
 
Hi Lee,
 
I've tested your code and it only keep the last value in mind. So only the moment as.
 
Don't know why but ill look it up more if you have any idea why let me know.
 
Cheers
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 20:32:38 | 显示全部楼层
 
Please note:
 


  • Only the lists for tiles rb1 & rb2 are defined, you need to define the rest.
  • The example code does not store any selected values, it simply displays the new list content following a radio button selection.
回复

使用道具 举报

91

主题

428

帖子

326

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
474
发表于 2022-7-5 20:35:51 | 显示全部楼层
 
 
You are welcome CadFrank.
 
 
I just revised slightly your own code, and as I tested, it works well.
回复

使用道具 举报

56

主题

259

帖子

213

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
270
发表于 2022-7-5 20:40:06 | 显示全部楼层
 
Haha!! just figured out why your's wasn't working. I didn't see you changed the dcl path location hehe! Now it works. Thanks alot ill let you know how the erst of the code goes  
 
Cheers !
回复

使用道具 举报

56

主题

259

帖子

213

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
270
发表于 2022-7-5 20:42:29 | 显示全部楼层
 
I've added the rest of the list and it still only show's the last radio list. If I select any of the other it won't display them.
 
it's like the other lists don't stay stored or something like that.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 09:12 , Processed in 0.978635 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表