Click here to Skip to main content
15,912,897 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Xml Parsing & Validating Pin
Ravi Bhavnani18-Aug-04 10:40
professionalRavi Bhavnani18-Aug-04 10:40 
GeneralDebug Assertion Failed! Please help me out!! Pin
Anonymous17-Aug-04 10:27
Anonymous17-Aug-04 10:27 
GeneralRe: Debug Assertion Failed! Please help me out!! Pin
peterchen17-Aug-04 10:52
peterchen17-Aug-04 10:52 
Generalbeeping the system speaker Pin
udi3217-Aug-04 8:27
udi3217-Aug-04 8:27 
GeneralRe: beeping the system speaker Pin
David Crow17-Aug-04 9:25
David Crow17-Aug-04 9:25 
GeneralRe: beeping the system speaker Pin
Andrew Walker17-Aug-04 13:28
Andrew Walker17-Aug-04 13:28 
GeneralRe: beeping the system speaker Pin
udi3219-Aug-04 14:12
udi3219-Aug-04 14:12 
GeneralList Control with Grouped View Pin
AndyCheetham17-Aug-04 8:16
AndyCheetham17-Aug-04 8:16 
Has anybody managed to get the grouping working with the list control (as seen in My Computer as it separates your hard drives from your CD ROMs for example)?
It feels like I have been banging my head against a brick wall all afternoon trying to get it to work with no joy.

I have created a new project with VS 2002 so I assume all the manifest requirements have been met.

I then get the list control from the CListView and add a group using the InsertGroup() function.

I then insert two items using the InsertItem() function and for each item I set the Group ID to the corresponding group.

This is the code I have so far. I would be eternally grateful if someone could point out what I am not doing correctly or have failed to do all together.

//Get the listCtrl from the View
CListCtrl& ctrl = GetListCtrl();
//View control in icon veiw
ctrl.ModifyStyle(0, LVS_ICON);
//Enable the Group View so we can group the entries
ctrl.EnableGroupView(TRUE);
//Add a Column
ctrl.InsertColumn(0, "Name");
ctrl.SetColumnWidth(0, 300);
//Add the groups to the control
LVGROUP* pGroup = new LVGROUP;
if(pGroup != NULL)
{
ZeroMemory(pGroup, sizeof(LVGROUP));
pGroup->cbSize = sizeof(LVGROUP);
pGroup->mask = LVGF_HEADER | LVGF_ALIGN | LVGF_STATE | LVGF_GROUPID;
pGroup->pszHeader = L"Coordinate Reference Systems";
pGroup->cchHeader = 28;
pGroup->stateMask = 0;
pGroup->state = LVGS_NORMAL;
pGroup->uAlign = LVGA_HEADER_LEFT;
pGroup->iGroupId = 0;
LRESULT res = ctrl.InsertGroup(0, pGroup);
TRACE("Group added");
}
//Add a second group
LVGROUP* pGroup2 = new LVGROUP;
if(pGroup2 != NULL)
{
ZeroMemory(pGroup2, sizeof(LVGROUP));
pGroup2->cbSize = sizeof(LVGROUP);
pGroup2->mask = LVGF_HEADER | LVGF_ALIGN | LVGF_STATE | LVGF_GROUPID;
pGroup2->pszHeader = L"Coordinate Reference Systems";
pGroup2->cchHeader = 28;
pGroup2->stateMask = 0;
pGroup2->state = LVGS_NORMAL;
pGroup2->uAlign = LVGA_HEADER_LEFT;
pGroup2->iGroupId = 1;
LRESULT res = ctrl.InsertGroup(1, pGroup2);
TRACE("Group added");
}

//Add a couple of items
LVITEM* pLVItem = new LVITEM;
ZeroMemory(pLVItem, sizeof(LVITEM));
pLVItem->mask = LVIF_GROUPID | LVIF_TEXT;
pLVItem->iItem = 0;
pLVItem->iGroupId = 0;
pLVItem->pszText = _T("Andy");
pLVItem->cchTextMax = 4;

ctrl.InsertItem(pLVItem);

LVITEM* pLVItem2 = new LVITEM;
ZeroMemory(pLVItem2, sizeof(LVITEM));
pLVItem2->mask = LVIF_GROUPID | LVIF_TEXT;
pLVItem2->iItem = 1;
pLVItem2->iGroupId = 1;
pLVItem2->pszText = _T("Richie");
pLVItem2->cchTextMax = 6;

ctrl.InsertItem(pLVItem2);

Cheers
AndyC
GeneralRe: List Control with Grouped View Pin
David Crow17-Aug-04 9:38
David Crow17-Aug-04 9:38 
GeneralRe: List Control with Grouped View Pin
AndyCheetham17-Aug-04 21:45
AndyCheetham17-Aug-04 21:45 
GeneralRe: List Control with Grouped View Pin
David Crow18-Aug-04 4:55
David Crow18-Aug-04 4:55 
GeneralRe: List Control with Grouped View Pin
AndyCheetham18-Aug-04 6:28
AndyCheetham18-Aug-04 6:28 
GeneralLoving Linux Pin
Rafael Fernández López17-Aug-04 7:49
Rafael Fernández López17-Aug-04 7:49 
GeneralRe: Loving Linux Pin
Jim Crafton17-Aug-04 10:22
Jim Crafton17-Aug-04 10:22 
GeneralRe: Loving Linux Pin
Ryan Binns17-Aug-04 19:15
Ryan Binns17-Aug-04 19:15 
GeneralRe: Loving Linux Pin
Jim Crafton18-Aug-04 15:43
Jim Crafton18-Aug-04 15:43 
GeneralRe: Loving Linux Pin
Neville Franks18-Aug-04 12:15
Neville Franks18-Aug-04 12:15 
GeneralRe: Loving Linux Pin
Jim Crafton18-Aug-04 15:42
Jim Crafton18-Aug-04 15:42 
GeneralRe: Loving Linux Pin
Henry miller18-Aug-04 5:46
Henry miller18-Aug-04 5:46 
GeneralRe: Loving Linux Pin
Jim Crafton18-Aug-04 16:07
Jim Crafton18-Aug-04 16:07 
GeneralRe: Loving Linux Pin
Henry miller19-Aug-04 3:37
Henry miller19-Aug-04 3:37 
GeneralSet Font for Windows Pin
Khanh Trinh17-Aug-04 7:33
Khanh Trinh17-Aug-04 7:33 
GeneralRe: Set Font for Windows Pin
David Crow17-Aug-04 9:29
David Crow17-Aug-04 9:29 
GeneralRe: Set Font for Windows Pin
Khanh Trinh17-Aug-04 19:01
Khanh Trinh17-Aug-04 19:01 
GeneralRe: Set Font for Windows Pin
David Crow18-Aug-04 5:29
David Crow18-Aug-04 5:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.