Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird behavior of 'Additem' and 'AddListItem' method
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00015486
Message ID:
00015601
Views:
38
>>Have somebody note the next situation :
>>Lets say that you have a form with a list that has
>>2 columns, my RowSourceType is set to 0-none,
>>and in the init event of my form I receive an
>>array that populates the list using the next code :
>>
>>PARAMETER aMyArray
>>LOCAL x
>>
>>FOR m.x=1 TO ALEN(aMyArray,1)
>> THISFORM.list1.addListItem(aMyArray(m.x,1),m.x,1)
>> THISFORM.list1.addListItem(aMyArray(m.x,2),m.x,2)
>>ENDFOR
>>
>>I did that to populate the two columns of my list,
>>then Foxpro returned me an error:
>> 'Not a numeric expression', in this line
>>
>>THISFORM.list1.addListItem(aMyArray(m.x,1),m.x,1)
>>
>>it doesn't recognize a memory variable, in this case
>>m.x, to know in which line of the list you want to
>>add the new item.
>>I needed to 'cheat' foxpro to make it work, I did
>>the next trick:
>>THISFORM.list1.addListItem(aMyArray(m.x,1),EVAL(STR(m.x)),1)
>>
>>I used EVAL(STR(m.x)), so fox will think it has a
>>a numeric expression, but it doesn't let you use the
>>memory variable directly.
>>I'm using 3.0, I don't know if this was fixed in 3.0b,
>>I'm going to try it in 5.0 and see what happens.
>
>I think that cursor would be natural RowSource for multi-column list. IMHO you could CREATE CURSOR..., INSERT ... FROM ARRAY ... and get whatever you want.

You are right Edward, but if you need to let the user 'add' and 'remove'
items from the list you have to use addItem, removeitem, AddListItem, etc..., and to use those your RowSourceType must be 5 or Array.
Thanks anyway for the suggestion.
Luis Guzman, MCP
"The only glory most of us have to hope for
is the glory of being normal." Katherine Fulleton Gerould
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform