![]() |
CMarkupListCtrl with checkboxes |
Post Reply ![]() |
Author | |
markr ![]() Senior Member ![]() Joined: 01 August 2004 Status: Offline Points: 443 |
![]() ![]() ![]() ![]() ![]() Posted: 06 November 2009 at 11:40am |
Hello,
In the MarkupSample MFC sample project, there is a class called CMarkupListCtrl that is quite interesting indeed. In an effort to add support for checkboxes, I changed the derivation of CMarkupListCtrl from CXTListBox to CXTCheckListBox. This seems to work just fine, but I can't help notice that the appearance of the checkboxes themselves are altered as a result. More specifically, the checkboxes lose their 3D appearance and become flattened (which, in turn, makes them appear larger). Is there any way to implement checkboxes within CMarkupListCtrl without altering their standard appearance? |
|
![]() |
|
markr ![]() Senior Member ![]() Joined: 01 August 2004 Status: Offline Points: 443 |
![]() ![]() ![]() ![]() ![]() |
I was able to figure this out on my own.
The trick is that the Init() method within CXTCheckListBox needs to be called in order to initialize theme support. The CMarkupListCtrl class overrides Init() and returns true, so first I tried calling Init() in the base class. This fails because eventually Init() gets called in CXTListBox (which is the base class for CXTCheckListBox), which in turn *enforces* application of the LBS_HASSTRINGS style flag. This style flag is not compatible with the way that CMarkupListCtrl is designed. So, the solution I found is to defer the Init() call and then toggle the style back, like this: bool CMarkupListCtrl::Init() { bool bres = __super::Init(); this->ModifyStyle(LBS_HASSTRINGS, 0, 0); return bres; } So far, this seems to be working nicely. Still testing to see if I somehow broke something else. :-) |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |