I have captured the user clicking on the header and i have the column in which the user clicked. I have a feeling its how I'm entering data into the list specifically the SetItemData, or the container that I'm using isn't supported for what the program is doing.
Header
Expand|Select|Wrap|Line Numbers
- typedef struct
- {
- LPTSTR Name;
- LPTSTR Age;
- LPTSTR Location;
- } ITEMDATA, *PITEMDATA;
- ...
- vector<ITEMDATA> MyVector;
*Note MyClass contains the same data elements + like 20 other elements which isn't shown on the list
Expand|Select|Wrap|Line Numbers
- void InsertListItem(MyClass MyClassObject)
- {
- ITEMDATA TempData;
- TempData.Name = MyClassObject.Name;
- TempData.Name = MyClassObject.Age;
- TempData.Name = MyClassObject.Location;
- MyVector.push_back(TempData); //Im not sure if assigning the values that way is the proper also
- int max = m_list.GetRowCount(); //m_list is the list control Object
- m_list.InsertItem(max, MyClassObject.Name);
- m_list.InsertItemText(max, 1, MyClassObject.Age);
- m_list.InsertItemText(max, 2, MyClassObject.Location);
- m_list.SetItemData(max, (LPARAM) &MyVector[MyVector.size()-1]);//i don't know if thats right
- }
Expand|Select|Wrap|Line Numbers
- void CEOB::OnHdnItemclickList(NMHDR *pNMHDR, LRESULT *pResult)
- {
- NMLISTVIEW *pLV = (NMLISTVIEW *) pNMHDR;
- m_list.SortItems(SortFunc, pLV->iItem); //iItem = column clicked
- //.SortItems(SortFunc, pLV->iItem);
- *pResult = 0;
- }
- int CALLBACK SortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
- {
- int nRetVal;
- PITEMDATA pData1 = (PITEMDATA)lParam1; //PData1 = bat ptr
- PITEMDATA pData2 = (PITEMDATA)lParam2; // same as above
- ...