乐筑天下

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

[编程交流] List_box crash!!!

[复制链接]

16

主题

64

帖子

48

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-6 08:21:12 | 显示全部楼层 |阅读模式
Hello guys,
Can any one help me with this case: in List_box I have a lot of members (more than 1000!). When I want to select more than 600 members AutoCad2009 is crashes down!!! Why?
This my routine :
  1. ;;; by shapooth;;; ; author of str-lst Evgeniy Elpanov(defun c:go () (setq i 1500b-list nilnew-blist nil) (repeat 1500   (setq b-list (cons (itoa i) b-list))   (setq i (- i 1)) )(defun str-lst (s p) ; author of str-lst Evgeniy Elpanov(if (vl-string-search p s) (str-lst (vl-string-subst """" p s) p) (read (strcat "("" s "")"))) ;if) ;;defun str-lst(setq list-str  '("Dialog"": dialog""{""  label = "check" ;""  : row ""   { ""     label = "list1" ;""     alignment = centered ;""    : column ""    { "      "    : list_box {""      key = "List1-d" ;""      width = 30 ; ""      height = 14 ;"      "      fixed_width = true ;""      fixed_height = true ;""      alignment = left ;""      multiple_select = true ;"      "      is_tab_stop = true ;""      }""    : text { key = "count1-d" ; } ""    } "      "       : column ""       { ""          : button ""          { ""          key = "Button-Add";""          is_default = false ; ""          fixed_width = true ; ""          alignment = left ; ""          label = "add" ; "    "          }""         } //column ""    : column ""    { "      "    : list_box {""      key = "List2-d" ;""      width = 30 ; ""      height = 14 ;"      "      fixed_width = true ;""      fixed_height = true ;""      alignment = left ;""      multiple_select = true ;"      "      is_tab_stop = true ;""      }""      : text { key = "count2-d" ; }""     } ""    }//row""  ok_only ;""} // dialog")) (setq cDCL "c:\\1.dcl") (setq f (open cDCL "w")) (foreach e list-str (write-line e f)) (close f) (setq f nil) (setq dcl_id (load_dialog cDcl)) (if (not (new_dialog "Dialog" dcl_id)) (exit)) (start_list "List1-d") (mapcar 'add_list b-list) ; (end_list) (set_tile "count1-d" (strcat "List1: " (itoa (length b-list)))) (action_tile "Button-Add" "(go-Button-Add)") (action_tile "List1-d" "(go-List1))")  (defun go-List1 ()   (set_tile "count1-d" (strcat "list1: "        (itoa (length b-list))        " / Sel: "        (itoa (length (str-lst (get_tile "List1-d") " ")))        ))   );defunn (defun go-Button-Add ()         (if (setq xy1 (str-lst (get_tile "List1-d") " "))     (progn(foreach e xy1  (progn    (setq ei (nth (atoi e) b-list))    (if (not (member ei new-blist))      (progn (setq new-blist (cons ei new-blist)) (setq new-blist (vl-sort new-blist '> )) (start_list "List2-d") (mapcar 'add_list new-blist) ; (end_list) (set_tile "count2-d" (strcat "List2: : " (itoa (length new-blist))))      );progn    );if  );progn);foreach     );progn    );if );defun  (start_dialog) (unload_dialog dcl_id)); defun
 
Thanks
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 08:28:25 | 显示全部楼层
Seems that there some limitations related to the number of items a list_box control can handle. May be useful to check if dos_multilist function from DosLib extension isn't a better approach.
 
Regards,
Mircea
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 08:32:47 | 显示全部楼层
 
If this is correct, it is ironic... That a list_box function has trouble processing large lists, yet is meant to work with LISP.  LoL
回复

使用道具 举报

16

主题

64

帖子

48

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-6 08:39:31 | 显示全部楼层
 
Hi RenderMan,
check it. Select first member from list and press shift button continiusly and then member 600. My AutoCad is 2009.
回复

使用道具 举报

16

主题

64

帖子

48

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-6 08:44:02 | 显示全部楼层
 
Hi msasu,
I will try to use dosLib extension.
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 08:44:53 | 显示全部楼层
Ironic or not, you can check by yourself: create a list with variable number of items, load it into a list_box control, select all items and see what it returns. On my tests it works well for 500 entries, but crash for 600. So, the limit lays somewhere between.
My answer was due to the fact that I had myself issues in the past with this control.
 
Regards,
Mircea
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 08:50:16 | 显示全部楼层
This is what I have used for my tests:
 

[code](defun TestLimitListBox( / theList DCLid theAnswer )(repeat 501   ;;;
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 08:53:58 | 显示全部楼层
 
 

 
You've missed my point completely.
 
DCL is meant to work with LISP, which can process incredibly large lists (not sure of their limit?). Hence Mapcar, Apply, etc., and this DCL function bombs after +/-600 list items - this is funny to me (while unfortunate for OP).
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 09:00:04 | 显示全部楼层
Should not forget that DCL was introduced with AutoCAD R12 and didn't evolved since...
 
Regards,
Mircea
回复

使用道具 举报

16

主题

64

帖子

48

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-6 09:02:53 | 显示全部楼层
 
Hi Mircea,
I saw this problem with DCL in c:go posted in OP. My be there is no limit for list_box because Autocad craches with any errors (0xC0000005 ... and so on). If List_box have an limit why Autocad will crash?
 
Regards Sharpooth
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-9 07:47 , Processed in 0.460014 second(s), 83 queries .

© 2020-2025 乐筑天下

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