I've set the listview to LVS_LABELEDIT, but i don't receive any LVN_BEGINLABELEDIT message when i click the listview..
The code below is working, except for that i have to disable the listview when editing a subitem..
If i can get the LVS_LABELEDIT parameter to work, will the listview create the edit box and all the handling, so i only have to receive the infostruct in the LVN_BEGINLABELEDIT/LVN_ENDLABELEDIT message?
Code:
case WM_NOTIFY: // Process messages from listview
switch(((LPNMHDR)lParam)->code){
case NM_DBLCLK:
if(((NMLISTVIEW*)lParam)->iSubItem && ((NMLISTVIEW*)lParam)->iItem>=0 && iCol==0){
ListView_GetSubItemRect(hwLst, ((NMLISTVIEW*)lParam)->iItem, ((NMLISTVIEW*)lParam)->iSubItem, LVIR_LABEL, &r1);
iCol = ((NMLISTVIEW*)lParam)->iSubItem;
GetLstItem(hwLst, achBuf, 300, ((NMLISTVIEW*)lParam)->iItem, ((NMLISTVIEW*)lParam)->iSubItem);
hwEdit = CreateWindowEx(WS_EX_CLIENTEDGE|WS_EX_TOPMOST|WS_EX_TRANSPARENT, "EDIT", achBuf, WS_BORDER|WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL, r1.left+3, r1.top+1, r1.right-r1.left+3, r1.bottom-r1.top+5, hwThis, (HMENU)TXT_EDIT, *pInst, 0);
SetFont(GetDlgItem(hwThis, TXT_EDIT), 8, "Ms Sans Serif");
ShowWindow(GetDlgItem(hwThis, TXT_EDIT), SW_SHOW);
EnableWindow(hwLst, 0);
wpr = (WNDPROC)SetWindowLong(GetDlgItem(hwThis, TXT_EDIT), GWL_WNDPROC, (long)SubProc);
SetFocus(GetDlgItem(hwThis, TXT_EDIT));
}
break;
case LVN_BEGINLABELEDIT:
b("LVN_BEGINLABELEDIT");
break;
case LVN_ENDLABELEDIT:
b("LVN_ENDLABELEDIT");
break;
}
break;
(The b() function displays a messagebox)