List_box crash!!!
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 :
;;; 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 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
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
Hi RenderMan,
check it. Select first member from list and press shift button continiusly and then member 600. My AutoCad is 2009.
Hi msasu,
I will try to use dosLib extension. 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 This is what I have used for my tests:
(defun TestLimitListBox( / theList DCLid theAnswer )(repeat 501 ;;;
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). Should not forget that DCL was introduced with AutoCAD R12 and didn't evolved since...
Regards,
Mircea
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
页:
[1]
2