Hi gurus.
How can I edite the subitems of a CListCtrl?? I only can edit the first value (first colum).
Thanks in advance
Printable View
Hi gurus.
How can I edite the subitems of a CListCtrl?? I only can edit the first value (first colum).
Thanks in advance
You can use CListCtrl::SetItemText
eg.
Its trying to set the text at, Row 3, Column 5, to become "yourString".Code:mListCtrl.setItemText( 2, 4, "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.
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??
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.
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
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.