views:

229

answers:

4

How to implement CEditListCtrl?. List control with edit capabality (Report/Grid view). I have a list view in Report View. It has some values. I need to extend this to edit the values present in the list view. I declared a class which inherits from CListCtrl. And I have handled the two Window messages to start and end the edit. Upon getting the messages I am displaying a Text box. But I am not getting the control inside these message handlers. Is there a way to know the reason?

Or Is there a other way to implement this.

A: 

You need to use a CComboBox which is basically a combined CEdit and CListCtrl

Shane MacLaughlin
But I am displaying a tree structure inside this list view. I think it is not possible with CComboBox
Vinay
Ok, my mistake. Have you tried using CListCtrl::GetEditControlto get a CEdit that you can use for editing.
Shane MacLaughlin
+1  A: 

Hi all, Thanks for all answers

I have done it easily.

  1. I have handled the WM_LBUTTONDOWN. This handler pops up the edit box to get the new value for the field
  2. Handled LVN_ENDLABELEDIT to know the end of update.
  3. After receiving the above message, updated the values.

“One thing I forgotten was to set the flag in the resource view for CListCtrl (Edit Labels to TRUE)”

We have to implement OnPaint() (in CListCtrl's derived class) also otherwise the UI won't update properly

Vinay
A: 

This question was also asked here:

http://stackoverflow.com/questions/253919/how-to-edit-columns-in-place-with-clistctrl#257598

You can read my answer on that page.

jussij