 |
|
 |
If you change the font to list control using WM_SETFONT each row is shown using new font, but the group text will remain displayed in standard font.
Do you have an idea on how to change also group text font ?
TIA
|
|
|
|
 |
|
 |
First of all, thanks for code.
Playing with groups I had some problem, maybe someone can help me.
Changing list control style to 'Icon' view cause painting problem and is possible to select only the first item of a group.
|
|
|
|
 |
|
 |
The best article I've found on CListCtrl Grouping.
|
|
|
|
 |
|
 |
Good article and codes to control Group of Listview.
One question:
Why lvhitinfo.iGroup always return 0? ListView_HitTestEx can't return right Index?
{
#if _WIN32_WINNT >= 0x0600
#ifdef ListView_HitTestEx
#ifdef LVHT_EX_GROUP
#ifdef ListView_GetGroupInfoByIndex
LVHITTESTINFO lvhitinfo = {0};
lvhitinfo.pt = point;
ListView_HitTestEx(m_hWnd, &lvhitinfo);
if ((lvhitinfo.flags & LVHT_EX_GROUP)==0)
return -1;
LVGROUP lg = {0};
lg.cbSize = sizeof(lg);
lg.mask = LVGF_GROUPID;
VERIFY( ListView_GetGroupInfoByIndex(m_hWnd, lvhitinfo.iGroup, &lg) );
return lg.iGroupId;
#endif
#endif
#endif
#endif
}
modified on Friday, July 22, 2011 8:38 PM
|
|
|
|
 |
|
 |
Sorry about the late response. I just returned from 2 weeks vacation with my family.
Yes you are completely right that the quoted code simply doesn't work. According to MSDN then iGroup will only be initialized if using owner data. I will try to update the article and remove the offending code.
Thank you for telling.
|
|
|
|
 |
|
 |
By default, Clicking Listivew GroupHeader will select the top most item on non-multiselect mode and select all on Multi Select mode. It is no ideal. We can do subclass Message WM_LBUTTONDOWN to bypass the default behavior. But it could lost LVN_LINKCLICK notification inhibited by WM_LBUTTONDOWN due to the message sequence is WM_LBUTTONDOWN --> LVN_LINKCLICK. I want to bypass WM_LBUTTONDOWN but keep LVN_LINKCLICK notification.How to solve this problem?
You could test your project by mouse clicking the GroupHeader, the behavior is a bit weird. Sometime,all items within the Group are selected,sometime no so. I hated it. We have to bypass MS Listview default action,but it brings another problem,LVN_LINKCLICK inhibited by WM_LBUTTONDOWN! Please make a trial and find a solution.
modified on Wednesday, July 27, 2011 5:11 AM
|
|
|
|
 |
|
 |
I can reproduce the behavior you describe, where clicking in the group header causes it to change item selection. It always remove selections from items in other groups, and if the focus is the group-title-link, then it causes all items in the group to be selected (If the group-task-link gets focus then no items are selected).
I guess an evil hack is to save the selection before forwarding the event to ClistCtrl, and then restore the original selection after having forwarded the event.
I guess another evil hack is to perform a HitTest, and then check if LVHT_EX_GROUP_SUBSETLINK is marked then manual sent the LVN_LINKCLICK.
LVHITTESTINFO Structure[^]
|
|
|
|
 |
|
 |
where clicking in the group header causes it to change item selection. It always remove selections from items in other groups, and if the focus is the group-title-link, then it causes all items in the group to be selected.
I am not satisfied with this funny logic which can't be accepted and is not practical.
group-task-link gets focus then no items are selected
All of group-task-link remain focus if being clicked! How to remove the focus to retain only one after clicking a group-task-link?
I guess an evil hack is to save the selection before forwarding the event to ClistCtrl, and then restore the original selection after having forwarded the event.
I guess another evil hack is to perform a HitTest, and then check if LVHT_EX_GROUP_SUBSETLINK is marked then manual sent the LVN_LINKCLICK.
I can't get the GroupID when mouse click group-task-link. Not sure why HitTest LVHITTESTINFO.Flags doesn't return LVHT_EX_GROUP_SUBSETLINK (0x2000000).
Edited: LVHT_EX_GROUP_SUBSETLINK is not group-task-link!!! I don't know where is such flag for HitTest of Group Task Link . ( http://msdn.microsoft.com/en-us/library/bb774754(v=vs.85).aspx[^] )
If you got time,please make a trial.
modified on Thursday, July 28, 2011 2:17 AM
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
the organised code is good
|
|
|
|
 |
|
 |
Hello,
is it possible to disable/hide the HeaderCtrl in this solution?
Ocrana
|
|
|
|
 |
|
 |
The CListCtrl supports the style LVS_NOCOLUMNHEADER
Use the Resource Editor -> Dialog "Properties" -> Styles -> check the checkbox "No columns header"
Though I guess you should disable (or check) all calls to GetHeaderCtrl() in the solution.
|
|
|
|
 |
|
 |
It make over 100 error when i use it in VC 6.0
What should i do?
|
|
|
|
 |
|
 |
No body know?
|
|
|
|
 |
|
 |
The MFC implementation bundled with VC6 doesn't support groups, since VC6 was released before CListCtrl supported groups.
The workaround is to use the Win32 API calls instead. To use the Win32 API calls then you need a Windows SDK that provides the proper defines for using groups.
Not sure if VC6 can use the latest Windows SDK from Microsoft directly. Microsoft have added several new keywords, which only their latest compiler understands. So you will probably have to do some cut'n'paste to create your own header file for VC6, that includes the proper defines needed to activate group-mode in CListCtrl.
You can see the defines you need by looking at the bottom of this file: CGridListCtrlGroups.cpp[^]
|
|
|
|
 |
|
 |
Snakefoot,
- Thank for you nice contribution!, I am really enjoy all of your articles about CListCtrl.
- Here is what I am doing: I tried to create a "report" which will add report header-1 first, then items belong to header1, then header2, then .....
- So what I have is: I can add header1 and can see it, I can insert first item which I set group flag on LVITEM along with TEXT and I can see it displayed. However, I can not see any sub-items I tried to add in for the same line!!!.
- In your example: you base on existing added items, and just try to group it!, that's why you don't see this problem?
- I am using WinXP, and I can see header display, so .. I assume I can play around with "grouping" feature?
Regards,
UglyBeast
|
|
|
|
 |
|
 |
And I guess you have called InsertColumn for the different subitems, and you can see those columns ?
And I guess you have called SetItemText for all the subitems, after having called InsertItem() ?
And I guess if you disable the grouping code, then the newly added items is displayed with all their subitems ?
|
|
|
|
 |
|
 |
snakefoot,
- actually I figure out that if I insert item with both IDGROUP and TEXT mask flags together, and I can see that item, then any SetItem call after that (also with TEXT+IDGROUP mask) won't "insert" sub item to same row with the first item.
- So, in order to insert item and its sub-items, I just do normal insert (with TEXT flag in mask field), then SetItem (with text in mask field). After that, I will "assign" that row to group, then I will see whole row display
- Anyway, thank for your nice CListCtrl articles
|
|
|
|
 |
|
 |
Hi,
I work with owner data list controls all the time.
When the grouping was released with XP I was very excited, until I noticed there was no support for owner data. Have MS implemented support for owner data list controls with Vista?
Interestingly it is hard to find people who use owner data lists. Once you get used to them, there is no going back.
Gerard
|
|
|
|
 |
|
 |
My experience with owner-drawn CListCtrl (when downloaded from internet places like Codeguru and Codeproject) is that they suffer from lots of different drawing-quirks when using them on an operating system newer than when the specialized CListCtrl implementation was created.
From this experience I usually try to stay away from them, and for that matter also custom-drawn CListCtrl's that tries to perform all the drawing themselves.
But back to your question about Vista support. Since there is no DrawGroup method on the latest SDK (Like there is a DrawItem), then I highly doubt it.
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Hi Snakefoot,
I have enjoyed reading your CListCtrl articles. Your CGridListCtrlEx and Show/Hide column articles are very elegant and demonstrate a high level of understanding of the CListCtrl class. I think you should ignore the univoters. Clearly these individuals have a lack of understanding of Microsoft Platform SDK updates.
Best Wishes,
-David Delaune
|
|
|
|
 |
|
 |
I absolutely agree with Randor. I really appreciate your CListCtrl articles, and I also appreciate the constant updates.
Your articles gave me the initial impulse to write my own -little- grid in WTL.
Thank you
Yarp
http://www.senosoft.com/
|
|
|
|
 |