OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: andrew.nao1 on August 21, 2012, 06:31:42 AM

Title: latest version broke my code
Post by: andrew.nao1 on August 21, 2012, 06:31:42 AM
I upgraded to the latest version 7.0.0.6 from 7.0.0.2

in my projects i have set a listbox to double click and it puts the text from the list box into acad. this worked with 7.0.0.2 but i get
; error: bad argument type: stringp
with the new version

attached are copies of my project with associated txt file
this is only 1 of 2 projects so far that i have found with this issue.



Title: Re: latest version broke my code
Post by: roy_043 on August 21, 2012, 07:43:11 AM
On line 212 you have this code:
Code (autolisp) Select
(setq strStockBookNumber (substr (dcl_ListBox_GetSelectedItems oSTKBK_Form1_ListBox1) 1 21))

Since (dcl_ListBox_GetSelectedItems) returns a list of strings this should be:
Code (autolisp) Select
(setq strStockBookNumber (substr (car (dcl_ListBox_GetSelectedItems oSTKBK_Form1_ListBox1)) 1 21))
Title: Re: latest version broke my code
Post by: owenwengerd on August 21, 2012, 08:20:34 AM
It was a bug in earlier versions that GetSelectedItems did not return a list for a single-selection listbox. It should now match the documentation by always returning a list.
Title: Re: latest version broke my code
Post by: andrew.nao1 on August 22, 2012, 06:26:27 AM
Quote from: owenwengerd on August 21, 2012, 08:20:34 AM
It was a bug in earlier versions that GetSelectedItems did not return a list for a single-selection listbox. It should now match the documentation by always returning a list.

i dont understand what this means

Title: Re: latest version broke my code
Post by: andrew.nao1 on August 22, 2012, 06:29:03 AM
Quote from: roy_043 on August 21, 2012, 07:43:11 AM
On line 212 you have this code:
Code (autolisp) Select
(setq strStockBookNumber (substr (dcl_ListBox_GetSelectedItems oSTKBK_Form1_ListBox1) 1 21))

Since (dcl_ListBox_GetSelectedItems) returns a list of strings this should be:
Code (autolisp) Select
(setq strStockBookNumber (substr (car (dcl_ListBox_GetSelectedItems oSTKBK_Form1_ListBox1)) 1 21))

by doing what you listed returns an error
; error: bad argument type: consp
Title: Re: latest version broke my code
Post by: roy_043 on August 22, 2012, 06:58:49 AM
Are you perhaps testing with 7.0.0.6 *AND* 7.0.0.2?
If you want your code to work with both versions you could try something like this:

Code (autolisp) Select
(setq tmp (dcl_ListBox_GetSelectedItems oSTKBK_Form1_ListBox1))
(if (listp tmp) (setq tmp (car tmp)))
(setq strStockBookNumber (substr tmp 1 21))