M76 Posted April 13, 2010 Posted April 13, 2010 I'm trying to create a listbox with dcl, to be able to select multiple items. But I can't find any hint how to go about it, the only example I could find in autocad is this: (defun selectItem( lstItems dcl-fileName dialogName / dcl_id LT lstLinkTemplates selectedItem) (setq dcl_id (load_dialog dcl-filename)) ; Load the DCL file (if (not (new_dialog dialogName dcl_id)) ; Initialize the dialog (progn (princ (strcat "\n " dcl-filename " dialog not found.\n")) (exit) ; Exit if this doesn't work ) ) ;; Construct list of items (start_list "selections") ; Specify the name of the list box (mapcar 'add_list lstItems) ; Specify the AutoLISP list (end_list) ;; ;; (defun getItemSelection() (setq selectedItem (nth (atoi $value) lstItems) ) (if (equal 4 $reason) ; Then user double-clicked item. (done_dialog)) ) ;; ;; Confirms that user selected an item and that the item exists in list ;; (defun check_i() (if (member selectedItem lstItems) (progn (set_tile "error" "") T ) (progn (set_tile "error" "Please select an item.") nil ) ) ) (action_tile "selections" "(getItemselection)") (action_tile "accept" "(if (check_i)(done_dialog 1))") (action_tile "cancel" "(setq selectedItem nil)(done_dialog 0)(exit)") (start_dialog) ; Display the dialog box (unload_dialog dcl_id) ; Unload the DCL file (princ "\n") selectedItem ; Return this value. ) But as I understand this only allows one selection in the listbox, how can I allow multiple selections? And what are the $value $reason variables, is there an explanation about this somewhere? Quote
MSasu Posted April 13, 2010 Posted April 13, 2010 Please check this thread: http://www.cadtutor.net/forum/showthread.php?t=44639 Regards, Quote
Lee Mac Posted April 13, 2010 Posted April 13, 2010 mutiple_select = true; As for the $value etc, look at: Working with Programmable Dialog Boxes > Managing Dialog Boxes > Action Expressions and Callbacks In VLIDE help Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.