Is there any easy way ? Example would be nice ? thx.
Posted on 2004-02-18 10:59:42 by AceEmbler
Hi,

Well, normally you would subclass the edit control...

WARNING MASM code, I haven't used this for a while :)

invoke SendMessage,hListView,LVM_EDITLABEL,lvitem.iItem,0

invoke SetWindowLong,eax,GWL_WNDPROC,ADDR LVEditProc
mov OldLVEditProc,eax


LVEditProc PROC hEdit:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

LOCAL tBuffer[256] :BYTE
LOCAL nItem :DWORD
LOCAL ItemData :LV_ITEM

invoke SendMessage,hListView,LVM_GETNEXTITEM,-1,LVNI_SELECTED
mov nItem,eax

.IF uMsg == WM_DESTROY
invoke SendMessage,hEdit,WM_GETTEXT,255,ADDR tBuffer
invoke StrLen,ADDR tBuffer
.IF eax != 0
mov eax,nItem
mov ItemData.iItem,eax
mov ItemData.iSubItem,0
lea eax,tBuffer
mov ItemData.pszText,eax
mov ItemData.imask,LVIF_TEXT
invoke SendMessage,hListView,LVM_SETITEMTEXT,nItem,ADDR ItemData
.ENDIF
invoke CallWindowProc, OldLVEditProc, hEdit, uMsg, wParam, lParam
ret

.ELSEIF uMsg == WM_KEYDOWN
mov eax,wParam
.IF al == VK_ESCAPE
mov ItemData.iSubItem,0
mov ItemData.imask,LVIF_TEXT
mov ItemData.cchTextMax,255
lea eax,tBuffer
mov ItemData.pszText,eax
invoke SendMessage,hListView,LVM_GETITEMTEXT,nItem,ADDR ItemData
invoke SendMessage,hEdit,WM_SETTEXT,0,ADDR tBuffer
.ENDIF
invoke CallWindowProc, OldLVEditProc, hEdit, uMsg, wParam, lParam
ret
.ELSE
invoke CallWindowProc, OldLVEditProc, hEdit, uMsg, wParam, lParam
ret
.ENDIF

xor eax,eax
ret
LVEditProc endp
Posted on 2004-02-18 13:57:12 by donkey
Common Control Macro Library

cocomacexampleListViewEditSubItems
Posted on 2004-02-19 02:28:05 by Four-F

Common Control Macro Library

cocomac\example\ListViewEditSubItems


a lot of code for such a task but thx, but still MS amazes me why they didnt implement editing subitems ???
Posted on 2004-02-21 07:29:49 by AceEmbler