Item Selection in List Control under MFC
(Page 1 of 4 )
The MFC list control using the report view can be a very powerful implementation of a control, with many sub items separated by clearly visible grids that still do not ruin the overall picture. Making an application inherit this Excel lookalike style is easier than it sounds. The down side of this, however, is that it lacks some major features, such as clear sub item selection.
Now this is not necessarily a bad thing. If it were already implemented it could sometimes be a down side for the user, as an additional unused code segment. On the other hand, if you want to have this option, you may implement it using some MFC paired with OOP knowledge. Of course this is a troublesome process, because as easy it seems at first glance, the painful aspect involves taking care of all of the special cases.
Due to this, many users turn to an already-implemented class. Just browse the Codeproject page, and after a few clicks you will find some implementations. A few are freeware that you may use it inside your application for no fee at all. The only problem with this approach is that users who did this in their spare time implement these, and code maintenance and debugging was not done throughout the implementation.
This small problem can be bypassed by acquiring a third party library. Nevertheless, keep in mind that you will have to pay some cash for this. However, if you can afford the time to develop your own, you will have the advantage of seeing both what happens in front of and behind the scenes, so if something strange happens you can find the upsetting code section more easily.
This article is designed to help you with this task, or to introduce a method for how you can achieve something like this. Additionally I will also show you how to exploit the custom drawing inside the MFC. This article is the third part of the series I allocated to the introduction of the MFC list control.
If you failed to read the first two, I invite you to read them here on the ASP Free website under the names of Controls inside MFC and The Virtual List. Of course, you may find them faster by clicking on my name and selecting from there the corresponding parts. These articles contain some crucial information that you will need to understand this article as well, so if you intend to keep reading I strongly advise to start with those.
Next: The Custom Draw >>
More BrainDump Articles
More By Gabor Bernat