hello all. happy new year.
im a bit rusty, so i need a bit of help if you can provide it.
in my project i have a listbox, that displays contents of a text file.
i click a button and it takes the selected lines (one at a time) and adds them to a list view, separating certain lines into certain columns. i would like to make it where i can select all in the list box or select multiple lines to add to the list view.
i have the properties for the listbox set to muliple for selection style. how can i get these items into the list view as ALL or MULTIPLE lines.
here is code snippet im currently using that i have working for 1 line at a time
i appreciate any and all help
(setq items (dcl_ListBox_GetSelectedItems dwgbrowser_Form3_ListBox1))
;;get title
(setq title (substr (nth 0 items) 1 42)) ;41
;;gets rev
(setq rev (substr (nth 0 items) 54)) ;53
(while (< (strlen rev) 6)
(setq rev (strcat rev " "))
); end while
;;gets dwg number
(setq dwgnum (substr (nth 0 items) 43 11)) ;11
(SETQ amrev1 dwgnum)
(defun make_list (strItem)
(list strItem)
)
(if sho_lst
(progn
(setq make_lst (mapcar 'list (make_list title) (make_list dwgnum) (make_list rev)))
(setq sho_lst (append sho_lst make_lst))
)
(progn
(setq make_lst (mapcar 'list (make_list title) (make_list dwgnum) (make_list rev)))
(setq sho_lst (append sho_lst make_lst))
)
)
(dcl_ListView_FillList dwgbrowser_Form3_ListView1 sho_lst)
Maybe this helps:
; (setq items (dcl_ListBox_GetSelectedItems dwgbrowser_Form3_ListBox1)) ; List of Strings
(setq items
'(
"DwgTitle1 DwgNum1 A"
"DwgTitle2 DwgNum2 B"
)
)
(defun Item->RowList (item)
(list
(vl-string-trim " " (substr item 1 42)) ; Title.
(vl-string-trim " " (substr item 43 11)) ; Dwg number
(vl-string-trim " " (substr item 54)) ; Revision
)
)
(defun c:ListViewTest ()
(setvar 'cmdecho 0)
(command "_OPENDCL")
(setvar 'cmdecho 1)
(dcl_Project_Load "ListViewTest.odcl" T)
(dcl_Form_Show ListViewTest_Form1)
(princ)
)
(defun c:ListViewTest_Form1_OnInitialize (/)
(dcl_ListView_AddColumns
ListViewTest_Form1_ListView1
(list
(list "Title" 0 (dcl_ListView_CalcColWidth ListViewTest_Form1_ListView1 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"))
(list "Dwg number" 0 (dcl_ListView_CalcColWidth ListViewTest_Form1_ListView1 "AAAAAAAAAAAAA"))
(list "Revision" 0 (dcl_ListView_CalcColWidth ListViewTest_Form1_ListView1 "AAAAAAAA"))
)
)
)
(defun c:ListViewTest_Form1_ButtonAppend_OnClicked (/)
(dcl_ListView_Clear ListViewTest_Form1_ListView1)
(dcl_ListView_FillList
ListViewTest_Form1_ListView1
(setq *sho_lst*
(append *sho_lst* (mapcar 'Item->RowList items))
)
)
)
(defun c:ListViewTest_Form1_ButtonReplace_OnClicked (/)
(dcl_ListView_Clear ListViewTest_Form1_ListView1)
(dcl_ListView_FillList
ListViewTest_Form1_ListView1
(setq *sho_lst* (mapcar 'Item->RowList items))
)
)
(princ "\nc:ListViewTest")
(princ)
works perfect
thanks