Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

$Value is too long from List_box with Multiple_select=True

10 REPLIES 10
Reply
Message 1 of 11
Anonymous
719 Views, 10 Replies

$Value is too long from List_box with Multiple_select=True

Hi,

 

I have a very long list in the dialog, f.e. 1000 items.

There is a problem with the $value and muliple select=True

The returnvalue $value ends after 255 but I selected much more. (strlen = 913)

 

What is wrong?

Johan

 

 

;(action_tile "LIJST" "(setq sel_list (longPicked $value FL))")


(defun longPicked (val lst / V sel)
  ;val= Svalue
  :lst is the complete list '("1" "2" .....  "1000")
  (setq val (read (strcat "(" Val ")") ))
  (setq sel (mapcar '(lambda (V) (nth V lst) ) Val))
  ;
)

 

$Value =

"0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
245 246 247 248 249 250 251 252 253 254 255"

 

2011-01-27_155311.jpg

 

10 REPLIES 10
Message 2 of 11
TerryDotson
in reply to: Anonymous

This is a very old problem, see my post from 11 years ago in a search on "multiple_select 256".

 

Check (get_tile) maybe that was fixed.  I don't know because I haven't used Lisp in many years.

Message 3 of 11
Hallex
in reply to: Anonymous

Here is what I used often, it's a semi-solution and a bit tricky though, but it's working for me
Of cource, in the DCl you have to set mode to multiple_select=true; for list_box
This will allow you to select a single or multiple items
This code is too old but hope that helps 🙂

Just change file name and dialog name inside the code

;;=======================Local defuns==========================;;

(defun str->list (string del)
  ;; by VK (2002)
  (if (setq pos (vl-string-search del string))
    (cons (substr string 1 pos)
          (str->list (substr string (+ pos 1 (strlen del))) del))
    (list string)
)
)
(defun popup (start end / )  
  ;; Fatty T.O.H. () 2007  * all rights released
  ;; usage: (setq lst (mapcar 'itoa (popup 9 99)))
  (if (< start (1+ end))
    (cons start
	  (popup (setq start (1+ start)) end)))
  )
  

(defun extract  (start end lst / )  
  ;; Fatty T.O.H. () 2007  * all rights released
  ;; usage: (setq lst (extract 9 99 (mapcar 'itoa (popup 1 999))))
  (if (< start (1+ end))
    (cons (nth start lst)
	  (extract (setq start (1+ start)) end lst)))
  )


;;=======================Main part==========================;;

(defun C:demo (/ dcl_id  ans fl sel_list)
(alert (strcat "Sigle mode selection:\nSelect item then press OK\n-----------------------------------\n"
	       "Multiple mode selection:\n"
	       "Select the starting item\n"
	       "then press and hold the Ctrl key, scroll down\n"
	       "select the ending item, release the Ctrl key\n"
	       "then press OK"))
(setq dcl_id (load_dialog "sci.dcl"))
  (if
    (not (new_dialog "sci" dcl_id))
    (exit)
  )
  (setq FL (mapcar 'itoa (popup 1 1000)))

  (start_list "LIJST")
  (mapcar 'add_list FL)
  (end_list)
(action_tile "LIJST" "(setq sel_list $value))")

 (action_tile "accept" "(done_dialog 1)")
  
  (action_tile "cancel" "(done_dialog 0)")

  (setq ans (start_dialog))
  
  (unload_dialog dcl_id)
  
(if (= ans 1)
(progn
  
  (setq sel_list (str->list sel_list (chr 32)))
	
    (cond ((= (length sel_list) 1)
	 (setq  sel_list (nth (atoi (car sel_list)) FL))
	   (print sel_list);<-- debug only
	   )
      

     ((= (length sel_list) 2)  
(progn
  (setq sel_list (extract (atoi (car sel_list))(atoi(cadr sel_list))FL))
  (print sel_list);<-- debug only
  
;; < do your other stuff here > ;;
  
  ))
  (T (alert "Nothing or more than 2 items selected")
  (setq sel_list  nil)))

       ))

  (setq *test* sel_list)
  (alert (vl-princ-to-string *test*));<-- debug only
  (princ)
  )

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 4 of 11
Anonymous
in reply to: TerryDotson

Terry,

 

You have a good memory 😉

Yes the problem is old and it seems that nothing has changed in 11 years.

Get_Tile is no solution I think.

 

But thanks anyway...

 

Johan

 

Message 5 of 11
Anonymous
in reply to: Hallex

Hallex,

 

Thank you for youre code.

 

This code lets you select not more than 2 items I believe.

When this is what I think, that is no soltion for me.

I want to select more than 256 items when that occurs.

The list can be up to 32.000 items I read in the help, why not select them all AutoDesk?

 

The $value is what returns from the list/button. This value stops at 256 selected items.

What is the alternative for $value?

Of course I can warn ore stop the list at 256 items, but that is not a nice way isn't it?

 

Johan

 

 

 

Message 6 of 11
Hallex
in reply to: Anonymous

I can select with this code  more than 255 item

See attached piccy

 

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 7 of 11
Anonymous
in reply to: Hallex

Dear Hallex,

 

Sorry , but now I get it. Smiley Wink

 

You select the first one and then last one with the control key and then you process the items between those two in the list also to make the complete list.

 

Yes a bit tricky, not the Windowsway but it works when needed.

 

I keep this way in mind, thank you.

 

Johan

 

 

Message 8 of 11
Hallex
in reply to: Anonymous

Hi Johan,

Agreed, this is not so handy for using, but anyway it works

You're quite welcome

Cheers 🙂

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 9 of 11
dgorsman
in reply to: Anonymous

Ok, I gotta ask - isn't there a better way of doing this i.e. a user is expected to select hundreds of items from a list that is in the thousands?  My first thought at seeing this type of situation is "How can a user realistically expect to use this?"

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 10 of 11
Anonymous
in reply to: Anonymous

Dear dgorsman,

 

No this is not a solution, only when nothing else works this is an option.

But it is not a nice option. It is not possible te select randomly multiple items in the list.

 

When you know a better way, please tell me 😉

The problem is the $Value returnvalue, this value can't get more than 256 items in the list.

I can't think of a other way than tio use this value

 

Best regards

 

Johan

 

 

Message 11 of 11
Anonymous
in reply to: Anonymous

I usually don't resort to third part solutions,

but this in one time I use dos_multilist for my larger/longer lists.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost