I have a CListCtrl with plenty of room for all of the items, and they all display correctly --- until selected! As soon as any entry is selected, the end of that entry is truncated and an ellipsis is added:
I have no idea why this is happening. You can't see it in this image, but even very short entries show this behavior, even if the entries above or below are much longer and display fully. Here's the .rc code that created the control (and dialog):
IDD_COMBOBOX_DIALOG DIALOGEX 0, 0, 320, 200
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "ComboBox"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,263,7,50,16
PUSHBUTTON "Cancel",IDCANCEL,263,25,50,16
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SINGLESEL |
LVS_SORTASCENDING | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER |
WS_TABSTOP,7,78,306,85
END
and here's the code from InitDialog() that sets up and populates the CListCtrl:
myListCtrl.InsertColumn(0,_T("Allergies"));
FILE *f = fopen("c:\\allergies.txt", "r");
char sz[100];
if (f)
while (fgets(sz,100,f))
myListCtrl.InsertItem(0, sz);
if (f)
fclose(f);
myListCtrl.SetColumnWidth(0,LVSCW_AUTOSIZE);
LVFINDINFO FI;
FI.flags = LVFI_PARTIAL|LVFI_STRING;
FI.psz = _T("A");
int i = myListCtrl.FindItem(&FI);
myListCtrl.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
myListCtrl.EnsureVisible(i, FALSE);
This one is making me really crazy. Any tips would be MUCH appreciated! Thanks for having a look.