OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: jrupert on February 04, 2014, 08:33:26 AM

Title: How to fill listview from foreach loop
Post by: jrupert on February 04, 2014, 08:33:26 AM
I have the following code;

(if (> LGTH 1)
    (progn
        (setq cntr 0)
   (foreach N L1
       (setq gbspn (rtos (car N) 2 0 ))
       (setq custpn (cadr N))
       (setq path (caddr N))
       (dcl_ListView_FillList GBSCC_FormGBSCC_ListView1
           (list
               (list gbspn cntr custpn cntr path cntr)
           )
       )
                               
       (setq cntr (+ cntr 1))
            )

        )
)

This works, but, only fills the listview with the last element of the list L1.
It seems as if the listview items are reset on each iteration.

Any suggestions on HOW to make this work?
Title: Re: How to fill listview from foreach loop
Post by: owenwengerd on February 04, 2014, 09:56:18 AM
Use the AddItem (http://www.opendcl.com/HelpFiles/index.php?page=Reference/Method/ListView/AddItem.htm) method instead.
Title: Re: How to fill listview from foreach loop
Post by: jrupert on February 04, 2014, 11:50:47 AM
Thank You very much sir!

I have been writing code since 1983 (not in AutoLisp obviously)...maybe someday I will learn this languge also!
Title: Re: How to fill listview from foreach loop
Post by: owenwengerd on February 04, 2014, 12:00:17 PM
You're very welcome! I have no doubt that you will learn this one as well. :)