views:

473

answers:

3

First what I want: The ability to display a grid with multiple columns, each cell having a custom render callback. So you might use such a control to display your inventory in a game, or something like the behaviour in Google Chrome where it shows a grid of popular pages you visit.

I've been playing with CListCtrl and while I can get custom rendering ability on each item, I can't get it work with columns - having say 3 items per row. The control has column-related methods but I think these are specifically for the built-in functionality where different attributes of an item are shown automatically in each column... not for providing a generic grid control.

So, does such functionality exist in MFC? If not then I wonder if the easiest approach is for me to actually insert each of the rows as an Item... and then the custom rendering draws the multiple cells in the row, I could also do custom UI to support clicking on the cells.

But what I really want is to be able to create a custom control, and add this as an item to a list - like in Flex for instance - so I/O etc is automatically handled.

Any advice/information welcome...

+1  A: 

I'm not aware of a built-in control, but I think you should take a look at this. The article is describing in detail the functionality of a fully featured MFC grid control, derived from CWnd, for displaying tabular data.

luvieere
I have come across that control; it seems it probably does what's wanted but it might be a struggle getting it into our project.
John
No pain, no gain
luvieere
I use this in a commercial app. Deployment is easy. There were a few subtle edge-case bugs we had to fix. Overall a great control and completely customizable - you have the source.
Aidan Ryan
+3  A: 

Dundas has thrown some of its (excellent) components in the public domain. Their Ultimate Grid is available on CodeProject.

Serge - appTranslator
A: 

Please try this: http://www.bcgsoft.com/featuretour/tour194.htm

Rob