So I'm finally getting around to playing with OpenDCL and I've run into a little snag. How do I get the selected item from a list box? The code belows fills a listbox with the saved UCSs in the current drawing, but I can't figure out how to get the selected UCS's name from the list box after I double-click on it.
(DEFUN C:TOOLBOX (/ fn)
(SETQ sVariable "Not set")
;;
;; Ensure the OpenDCL.##.ARX is loaded.
(OR (VL-SYMBOL-VALUE 'ODCL_GETVERSIONEX)
(AND (SETQ fn (FINDFILE "OpenDCL_ARXLoader.LSP"))
(LOAD fn (STRCAT "Failed to load :- " fn))
)
(ALERT (STRCAT "Failed to load OpenDCL_ARXLoader.LSP"))
(EXIT)
)
;;
;; Ensure the Project ODC file is loaded.
(OR (ODCL_PROJECT_LOAD "Toolbox") (EXIT))
;;
;; Show the modal dialog .. (odcl_Form_IsActive test is not required
;;
(ODCL_FORM_SHOW Toolbox_frmMain)
(LoadUCSs)
(PRINC)
)
(defun LoadUCSs ( / strUCSName strUCSList)
(setq strUCSList (tnlist "UCS"))
(Odcl_ListBox_Clear Toolbox_frmMain_lstUCSs)
(Odcl_ListBox_AddList Toolbox_frmMain_lstUCSs strUCSList)
(princ)
)
;;Michael Puckett
(defun tnlist (s / d r)
(while (setq d (tblnext s (null d)))
(setq r (cons (cdr (assoc 2 d)) r))
)
(reverse r)
)
(princ)