ListView seems to be the tight tool for the job. However, making use of the built-in label editing functionality is proving to be troublesome. It creates an editbox itself over the list item and you can grab a handle to it with LVM_GETEDITCONTROL, but it only does that on the first column. Using EM_SETRECT or SetWindowPos() to move it over another column refuses to work. I wish somebody would do proper examples of stuff like this without MFC.
Here's where I'm having issues:
Code:
case LVN_BEGINLABELEDIT:
hEditBox = (HWND)SendDlgItemMessage(hwnd, LST_DATA, LVM_GETEDITCONTROL, 0, 0);
LV_ITEM lvItem = ( (NMLVDISPINFO*)lParam )->item;
DWORD dwPos = GetMessagePos();
POINT pLoc = { GET_X_LPARAM( dwPos ), GET_Y_LPARAM( dwPos ) };
ScreenToClient( hwnd, &pLoc );
LVHITTESTINFO lvHit;
lvHit.pt.x = pLoc.x;
lvHit.pt.y = pLoc.y;
lvHit.iItem = lvItem.iItem;
int item = SendDlgItemMessage(hwnd, LST_DATA, LVM_SUBITEMHITTEST, 0, (LPARAM)&lvHit);
// sprintf(txtInput,"%d",lvItem.iSubItem);
// MessageBox(hwnd,txtInput,"Debug",0);
RECT lvRect = { lvHit.iSubItem, LVIR_LABEL };
SendDlgItemMessage(hwnd, LST_DATA, LVM_GETSUBITEMRECT, lvItem.iItem, (LPARAM)&lvRect);
SetWindowPos(hEditBox,NULL,lvRect.left,lvRect.top,0,0,SWP_SHOWWINDOW|SWP_NOZORDER|SWP_NOSIZE);