ListControl in a tabbed PropertyPage does not display contents
I have a list control in a Propertypage that is part of a propertysheet. As
data is inserted into the listcontrol, the list control appropriately creates
the scroll bar and the column headers, but the data itself is not visible. If
I replicate the exact same code as part of a CDialog that holds the
listcontrol, the listcontrol displays contents. Am i missing some things.
Env:
Visual Studio 6.0
Windows XP
Details:
Created the PropertyPage using the classWizard and updated the Dialog Data
to reflect the correct IDD
enum { IDD = IDD_COPY_AND_CREATE };
CListCtrl m_list;
Here is how I prepare the control
void CEditOldToNewListDlg::PrepareListCtrl()
{
LV_COLUMN pColumn;
int fillcnt1;
char tusstring[50];
pColumn.mask = LVCF_FMT|LVCF_TEXT|LVCF_WIDTH;
for (fillcnt1 = 0; fillcnt1 < 3; fillcnt1++)
{
switch (fillcnt1)
{
case 0 : strcpy(tusstring,"A"); pColumn.cx = 120; pColumn.fmt =
LVCFMT_LEFT; break;
case 1 : strcpy(tusstring,"B"); pColumn.cx = 120; pColumn.fmt =
LVCFMT_LEFT; break;
case 2 : strcpy(tusstring,"C"); pColumn.cx = 150; pColumn.fmt =
LVCFMT_CENTER; break;
default : strcpy(tusstring, "N/A"); pColumn.cx = 120;
pColumn.fmt = LVCFMT_LEFT; break;
}
pColumn.pszText = tusstring; pColumn.cchTextMax = strlen(tusstring)+1;
m_OldNewList.InsertColumn(fillcnt1, &pColumn);
}//loop over all columns
m_DoColumns = FALSE;
}
Here is how i Display Items:
BOOL CCopyAndCreatePage2::DisplayItem(TwoCodes *ThisOne)
{
LV_ITEM lvItem;
if (m_DoColumns) PrepareListCtrl();
if (ThisOne == NULL) return FALSE;
lvItem.mask = LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM;
lvItem.iItem = m_NextItem;
lvItem.iSubItem = 0;
lvItem.iImage = 0;
lvItem.pszText = LPSTR_TEXTCALLBACK;
lvItem.lParam = (LPARAM) ThisOne;
m_list.InsertItem(&lvItem);
m_NextItem++; UpdateWindow(); UpdateData(FALSE);
m_list.SetRedraw(TRUE);
return (TRUE);
}
Am i missing something?. Any help would be appreciated.