Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to read a subitem out of a listview
Message
 
To
12/12/2003 04:03:44
Gerrit Masee
University Hospital Groningen
Groningen, Netherlands
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00857609
Message ID:
00858690
Views:
22
>Hi, Terry,
>Maybe I was not clear enough. My listview comes up with some data.
>Now I want the user to select one item (not the complete row) by right-click and then bring that item to lets say a table. Therefore I have to know which subitem was right-clicked.

I think I understand. But the LabelEdit is only available for the ListItem column. However, I do not edit the "ListItem" node with this method. I push the data at it with a VFP textbox. To edit the other columns, you have to key in your changes to another control (TextBox) and then write the changes to the Subitem's text property:
.SelectedItem.ListSubItems(.COLUMNHEADERS(cColumnKey).SubItemIndex).text=myForm.MyTextBox.Value
Two ways (off the top) to do this. One - have some full-time textboxes on the form with the listview and assign their values from the listview row, or (better yet) from the data source the listview [row] was populated from (when the listview row is selected (Node Click)

-PS Remember: To implicitly set the nodes selected property to true inside your node click and any procedures that programatically select a listview node:
oLV.ListItems(lcNodeKey).Selected=.t.
I use the LV mostly as a navigator. Usually the ListItem key (SelectedItem.Key) stores the file pointer keys) that point to a record in a table corresponding to the LV row. When the row is clicked, the NodeClick event gets the ListItem key, uses it to get the data source record and then assigns the corresponding fields to textbox values.

Another way to do this would be a right click on an LV item that would do the same thing (get the corresponding data from a table), to populate entry controls with field data on a popup form. When the changes are saved, write them back to the data source (table/DBF) and update the corresponding Subitems.

You can use field names of the data source as columnheader keys just to make life easy:-)

But - as best as I understand - the only LV column available for edit through through the LV is the ListItem text (the first node). The others (SubItems) have to have edit changes pushed from an external control with diction similar to the example above.
HTH

OBTW - there is a download #16575 that demonstrates a writeback using treeview.

I will look for a little project form that does this and email it to you if you think it would be helpful.
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform