Jump to content

How to store the item name of a listbox in a variable?


Recommended Posts

Posted

I'm trying to create a .dcl with a listbox with all my blocks, how to store the ITEM NAME in a variable?

(action_tile "accept" "(setq nameitem $value)")
_$ "1"

How to get the ITEM name?
_$ "Block 01"

 

item.PNG.502b0dbaf73cc97155ff5da0348dfef4.PNG

 

Posted (edited)

Use NTH with your list of blocks.

Something like this .. will work for multiple select too:

(defun _getlistboxselection (lst sel)
  (mapcar '(lambda (x) (nth x lst)) (read (strcat "(" sel ")")))
)
(_getlistboxselection '("My" "Items" "In" "A" "List") "0 2 4")

 

Edited by ronjonp
  • Thanks 1
Posted (edited)

Thank you!! @ronjonp
Very good!!

Edited by JuniorNogueira
Posted (edited)

If you are only looking to present the user with a single List Box as an interface, below are two ready-made functions that you may wish to call from your program:

 

List Box

List Box with Filter

 

Or at least, you could look at the code to see how the selections are handled - essentially the same technique as @ronjonp :)

 

Hope this helps!

Edited by Lee Mac

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...