Is it possible to edit data in place using CListCtrl - if not, can anyone suggest an alternative control in MFC?

StackOverflow https://stackoverflow.com/questions/2400733

  •  18-09-2019
  •  | 
  •  

Question

I'm designing a MFC app in which I'd like to have a grid with 2 coloumns : both editable in which the user will input data and the app will get notified about it. The number of rows can be increased/decreased by the user as he wants - What would be the ideal MFC control to use for this kind of requirement ?

This is my first time designing a MFC app , so dont mind if it sounds too noobish :)

Was it helpful?

Solution

It's not a noobish question. Actually you have encountered a problem which bugs every MFC developer since 15 years: The MFC library does not have a built-in Grid Control. And a kind of Grid Control is what you are looking for, I guess. As far as I'm aware of, it is not possible to edit two columns in a CListCtrl. Only the first column, the "Label", can be edited.

For a Grid control you have to look for appropriate Third-Party tools which can be added to your projects, for instance as ActiveX controls. (I remember that the old Visual Studio 6 came with an "MS FlexGrid" which you could add with the component gallery to the project, but I've never worked with it, so I don't know if it's a good choice. But perhaps enough for your purpose.) Most third-party Grid controls require license fees but here is one (quite powerful) grid for free (at least free of fees but not of a license):

http://www.codeproject.com/KB/miscctrl/gridctrl.aspx

(or google by "MFC Grid Control" or something like that. I think there will be more free grids.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top