Hi,
I am having a trouble setting subitem text in listbox control located in dialogbox. The columns are added just right, but LVM_SETITEM message doesn't seem to work. Am i missing here something?





.if uMsg == WM_COMMAND
.elseif wParam == ID_DIALOGLIST

invoke DialogBoxParam, hInstance, 400, hWin, ADDR dproc, 0

.endif
.endif

dproc proc hWin:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD

Local lvi:LV_ITEM
Local lvc:LV_COLUMN
Local ListH:DWORD

.if uMsg == WM_INITDIALOG

invoke CreateWindowEx, WS_EX_RIGHTSCROLLBAR, addr class_list, NULL, WS_BORDER or LVS_REPORT or WS_CHILD or WS_VISIBLE, 5, 5, 400, 200, hWin, NULL, hInstance, NULL
mov ListH, eax

mov lvc.fmt,LVCFMT_LEFT
mov lvc.imask,LVCF_TEXT+LVCF_WIDTH
mov lvc.pszText,offset columnlable1
mov lvc.lx,30
mov lvc.iSubItem,0
invoke SendMessage, ListH, LVM_INSERTCOLUMN, 0, addr lvc

mov lvc.pszText,offset columnlable1
mov lvc.lx,60
invoke SendMessage, ListH, LVM_INSERTCOLUMN, 1 ,addr lvc

mov lvi.iItem, 0
mov lvi.iSubItem, 1
mov lvi.imask, LVIF_TEXT
mov lvi.pszText, offset itemlabel
mov lvi.lParam, 0
invoke SendMessage, ListH, LVM_SETITEM, 0, addr lvi


.elseif uMsg == WM_CLOSE
invoke EndDialog, hWin, 0
.endif

xor eax, eax
ret

dproc endp
Posted on 2004-09-11 12:13:44 by arafel
well looks like you have a listview and not a listbox. anyways you need to add an item to have a subitem. so first set the item and then the subitem.

invoke   SendMessage, ListH, LVM_INSERTITEM, 0, addr lvi ;for items


invoke SendMessage, ListH, LVM_SETITEM, 0, addr lvi ;for subitems


Posted on 2004-09-11 20:51:19 by smurf
oh yes i meant listview.
and actually i insert item first, just forgot to type it here. this is what happens when trying to fix something for hours in a middle of the night :lol:

so the problem not in the LVM_INSERTITEM. All other messages sent to listview work fine besides those two. strange..
Posted on 2004-09-12 04:20:22 by arafel
ooopps. just figured it out. what a stupid mistake :oops:.

thanks anyway.
Posted on 2004-09-12 04:39:56 by arafel
Hi...

Try to have a look to ---> http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/listview/reflist.asp

http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/listview/reflist.asp

I hope you will find what you want in this msdn help ...

I wish to you a good enjoy...

Gerard...
-----------
Posted on 2004-09-12 12:08:36 by gerard