I am creating a modal dialog with a listbox with a number of columns in it. Here is how I initialize the listbox:
DGListDisableDraw(dialogID, UpdatesList);
w = DGListGetItemWidth(dialogID, UpdatesList);
cw = w / NoteColumn;
DGListSetTabFieldCount (dialogID, UpdatesList, NoteColumn); //number columns in the data
// The headers
DGListSetHeaderItemCount(dialogID, UpdatesList, NoteColumn);
DGListSetHeaderFlags(dialogID, UpdatesList, true, false, false);
char ch[256];
short lc;
for (short i=1; i<=NoteColumn; i++)
{
lc = i==NoteColumn ? w : cw*i-1;
DGListSetTabFieldData(dialogID, UpdatesList, i, (cw-1)*i, lc, DG_IS_LEFT, DG_IS_NOTRUNC, true, true);
DGListSetHeaderItemFlags(dialogID, UpdatesList, i, DG_IS_LEFT|DG_IS_NOTRUNC, true);
ACAPI_Resource_GetLocStr (ch, 32501, i);
DGListSetHeaderItemText(dialogID, UpdatesList, i, ch);
}
...
fill in the data into the columns
...
DGListEnableDraw(dialogID, UpdatesList);
DGInvalidateItem (dialogID, UpdatesList);
The dialog is getting built correctly but when it displays it looks like the image here. As you can see
a) the first column of text is not shown.
b) the remaining columns (except the last) are center justified when they should be left justified.
c) Only about 1/2 of the first letter of each value is visible.
All I have to do it resize any of the columns by any amount and suddenly everything is redisplayed and shown properly.
Any ideas why?