views:

121

answers:

1

I have CListBox control that has 2 columns and any number of rows. I want the user to be able to click(or maybe double-click) a "cell" and be able edit the text therein.

See this screenshot

(Can't post images yet, need +10).

What I mean is that I want to be able to click and edit any of the places where it says "TEST" by clicking on the text to make it editable.

How should I go about this? I suppose I should use a mouse click event but how would I make the cell editable?

+2  A: 

This looks like a list control in report mode, which is different from a list box. A list box doesn't support editing contents at all. You can write code entirely on your own to get the contents of a line, copy that to an edit control, display the edit control exactly where the existing content was shown, allow the user to edit, and copy data back when/if the user hits return.

A list control allows editing of one (and only one) field. If you want to support more, you have a couple of choices. One would be about like above, creating your own edit control in the right place. The obvious alternative would be to look up one of the many grid controls. CodeProject has a number of variations.

Jerry Coffin
That's what I was looking for, thanks.
Pedro