Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MultiCoolumn MoverListBox
Message
From
10/09/1997 10:24:32
Dave Emerson
Dc Emerson Consult8Ng, Inc
Destin, Florida, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00049176
Message ID:
00049303
Views:
63
>>Has anyone found the key to moving an item from one listbox to another if the item is a multicolumn item.
>>
>>When I try to move each column (3) separately using the AddItem method, the moved to listbox has 3 new items. What I want is 1 new item with the 3 columns.
>>
>>I checked the Solutions sample code, but that only uses 1 column.
>>
>>TIA,
>>Dave Emerson
>
>Dave, read the Help for AddItem and form AddListItem. They show how to use the index of the new item to then add information to the other columns. You may need a separate command for each column.
>
>Barbara

Using the AddItem method with the next available index is what I have done. Here is the code from the InteractiveChange method of the available list placing the selected item into the selected list:

iCnt = This.ListIndex && the index of the selected item in the available list
lnListCount = ThisForm.lstSelected.ListCount+1 && the next index in the selected list
ThisForm.lstSelected.AddItem(This.List(iCnt,1),lnListCount,1) && the first column
ThisForm.lstSelected.AddItem(This.List(iCnt,2),lnListCount,2) && second
ThisForm.lstSelected.AddItem(This.List(iCnt,3),lnListCount,3) && third

Each AddItem adds an item to the appropriate column, but into the same row number, eg. 1. As the help for AddItem says, "If you specify an nIndex that already exists, the item is inserted at that position and all items below that item are moved down one position in the list portion of the ComboBox or ListBox control." As a result each column gets added to row 1 and any item already present gets pushed down a row. Furthermore, the last item gets added to column 1 as well as colum 3. The resulting list looks like this:

third column value third column value
second column value
first colum value

See my exasperation?
Dave
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform