Multicolumn listbox
-
I have a requirement to fill the listbox with 2 columns. I know how to implement a listbox with single column? Could someone tell me how to do it? Thanks
-
-
I am getting an assertion failure in the last line of this function. When I click the 'Ignore' button, I am getting a message box with the message 'Unsupported operation was attempted'. I donot have any clue to fix it? Pl help me. BOOL displaydlg::OnInitDialog() { CListCtrl *plistb = (CListCtrl *) GetDlgItem(IDC_LIST2); LV_ITEM lvI; // Initialize LV_ITEM members that are common to all items lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE; lvI.state = 0; lvI.stateMask = 0; lvI.iImage = 0; CString str; int i =0; if (m_pSet1->IsOpen()) { m_pSet1->Close(); } m_pSet1->Open(); while (!m_pSet1->IsEOF()) { lvI.iItem =i; lvI.iSubItem = 0; str = m_pSet1->m_Type; lvI.pszText = (LPSTR)LPCTSTR(str); lvI.cchTextMax = MAX_ITEMLEN; lvI.lParam = (LPARAM) i; if (plistb->InsertItem(&lvI) == -1) AfxMessageBox(_T("ListSelectData::FillListCtrl error"), MB_OK); i++; m_pSet1->MoveNext(); } return CDialog::OnInitDialog(); }
-
I am getting an assertion failure in the last line of this function. When I click the 'Ignore' button, I am getting a message box with the message 'Unsupported operation was attempted'. I donot have any clue to fix it? Pl help me. BOOL displaydlg::OnInitDialog() { CListCtrl *plistb = (CListCtrl *) GetDlgItem(IDC_LIST2); LV_ITEM lvI; // Initialize LV_ITEM members that are common to all items lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE; lvI.state = 0; lvI.stateMask = 0; lvI.iImage = 0; CString str; int i =0; if (m_pSet1->IsOpen()) { m_pSet1->Close(); } m_pSet1->Open(); while (!m_pSet1->IsEOF()) { lvI.iItem =i; lvI.iSubItem = 0; str = m_pSet1->m_Type; lvI.pszText = (LPSTR)LPCTSTR(str); lvI.cchTextMax = MAX_ITEMLEN; lvI.lParam = (LPARAM) i; if (plistb->InsertItem(&lvI) == -1) AfxMessageBox(_T("ListSelectData::FillListCtrl error"), MB_OK); i++; m_pSet1->MoveNext(); } return CDialog::OnInitDialog(); }
-
-
I am getting an assertion failure in the last line of this function. When I click the 'Ignore' button, I am getting a message box with the message 'Unsupported operation was attempted'. I donot have any clue to fix it? Pl help me. BOOL displaydlg::OnInitDialog() { CListCtrl *plistb = (CListCtrl *) GetDlgItem(IDC_LIST2); LV_ITEM lvI; // Initialize LV_ITEM members that are common to all items lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE; lvI.state = 0; lvI.stateMask = 0; lvI.iImage = 0; CString str; int i =0; if (m_pSet1->IsOpen()) { m_pSet1->Close(); } m_pSet1->Open(); while (!m_pSet1->IsEOF()) { lvI.iItem =i; lvI.iSubItem = 0; str = m_pSet1->m_Type; lvI.pszText = (LPSTR)LPCTSTR(str); lvI.cchTextMax = MAX_ITEMLEN; lvI.lParam = (LPARAM) i; if (plistb->InsertItem(&lvI) == -1) AfxMessageBox(_T("ListSelectData::FillListCtrl error"), MB_OK); i++; m_pSet1->MoveNext(); } return CDialog::OnInitDialog(); }
-
-
-
-
Getting an assertion failure immediately. If I click 'Ignore' button, an message box appears with msg 'unsupported operation was attempted'
-
I fixed the problem. The assertion failure is thrown when calling DoDataExchange(); CDialog::OnInitialUpdate() calling CDialog::UpdateData(FALSE) calling CDialog::DoDataExchange(..). Actually I had an button control in the dialog and an corresponding button variable in the Dialog class and hence the DoDataExchange() had an line containing button variable. Then I removed the Button variable from the resource. But didnot remove from the code. I tried to remove the button variable from the Dialogs class and DoDataExchange() and thus it worked. Thanks for your help. Sorry for the trouble.