using GetSelectedNths in list view

Started by andrew, January 19, 2010, 06:00:41 AM

Previous topic - Next topic

andrew

when using GetSelectedNths in the list view, when setting it to a variable (see code)


(setq selnth (dcl_ListView_GetSelectedNths project_Form3_ListView1))


it returns the nth in parentisis IE: (4) or (2)
this isnt good when trying to use it in a lisp function.

is there a different way to get the nth of a selected item in a list view that just returns the number without the parenthisis
or is it better to just write a function to remove them?

i appreciate any feedback


Kerry


I haven't tested, but ;

The method allows for multi-selected items.

The docs state : This method returns a list containing the indices of selected items.

Have you discovered differently ?


///---

I'd suggest writing a library function to return the value(s) you want from the list, or to iterate the list as required.
Perfection is not optional.
My other home is TheSwamp

andrew

Quote from: Kerry Brown on January 19, 2010, 07:02:51 AM

I haven't tested, but ;

The method allows for multi-selected items.

The docs state : This method returns a list containing the indices of selected items.

Have you discovered differently ?


///---

I'd suggest writing a library function to return the value(s) you want from the list, or to iterate the list as required.

i understood the indices as being the location of where the selected item is in the list.
am i not understanding is correctly?

owenwengerd

It sounds like you understand it correctly. What exactly is the problem you have?

andrew

Quote from: owenwengerd on January 19, 2010, 08:52:43 AM
It sounds like you understand it correctly. What exactly is the problem you have?

Owen,
im attempting to get the selected nth to use in another function
use the function in my first post it returns the correct nth but it has parenthesis around the number IE (4)
and using the nth of the selected item in the function isnt working because of ( )

am i using this function incorrectly to get the nth?

here is the code im wanting to use to get the nth to work with
it lets me remove a selected item from a list


(defun remitem (lst pos)
  (vl-remove-if
    (function
      (lambda (x)
        (eq (nth pos lst) x)
      )
    )
    lst
  )
)

(setq lst slst)

useage:
(remitem lst "nth goes here")

using the function (dcl_ListView_GetSelectedNths project_Form3_ListView1)
returns for example (4) when what im after is just 4

owenwengerd

If it's a single selection list view, just use the GetCurSel method instead. Your best source of information for working with lists is the AutoLISP reference guide that comes with AutoCAD.