-
October 3rd, 2007, 03:43 AM
#1
Editing subitems of CListCtrl
Hi gurus.
How can I edite the subitems of a CListCtrl?? I only can edit the first value (first colum).
Thanks in advance
Last edited by juanpast; October 3rd, 2007 at 03:46 AM.
-
October 3rd, 2007, 04:11 AM
#2
Re: Editing subitems of CListCtrl
You can use CListCtrl::SetItemText
eg.
Code:
mListCtrl.setItemText( 2, 4, "yourString" );
Its trying to set the text at, Row 3, Column 5, to become "yourString".
Assuming that the row number and column number really exist.
If you need to set other variables other than text of the subitem, then you have to use CListCtrl::GetItem and populate the LVITEM structure properly to retrieve their attributes. Then a call to CListCtrl::SetItem to save the changes that you have made.
Last edited by justin0108; October 3rd, 2007 at 04:16 AM.
-
October 3rd, 2007, 05:52 AM
#3
Re: Editing subitems of CListCtrl
Thanks, but I not explain well....
when you have a subitem into a view and you want to edit clicking over the text. It is possible with the first item but no in subitems....
How I can edit (clicking over the text) the subitems??
-
October 3rd, 2007, 06:16 AM
#4
Re: Editing subitems of CListCtrl
Hello,
It is not possible to edit the subitems of the listbox. You can edit the selected item in a combobox. But with some coding, you can edit the item in a listbox also.
Since clicking results in selecting an item in listbox, you need another event to start editing, like left button double click or middle button click. On that event, create an edit box spanning the rectangle of that item in listbox. In the event of selection change, delete the edit box after copying the string as the item of the list box.
I am thinking of writing this method as a FAQ, which you may refer once it is accepted.
Regards,
Pravin.
-
October 3rd, 2007, 06:28 AM
#5
Re: Editing subitems of CListCtrl
It is possible to obtain the pointer of the editbox? and if it is true we can modify the text....
Derivating the CListCtrl, we can obtain the list of the editbox??
I think it is better to wait for found a good solution to write this in FAQs...
Thanks
-
October 3rd, 2007, 09:42 AM
#6
Re: Editing subitems of CListCtrl
While you can't edit the subitem text directly, you can 'overlay' an edit box over the subitem and essentially get the same functionality. Using this technique you can also edit via an edit box, drop list combo box or some other control. Check out the LVEdit.Zip sample found in this post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|