How can I set TV items and their childs option at the same time.I am trying to set checkboxes next to them if parent one is selected.Here is the rutine I try


SetCheckStateOfChildren proc uses esi hwndTV:DWORD,tvit:DWORD, state:DWORD
LOCAL nodeChild:DWORD
LOCAL hItem:DWORD
mov esi,tvit
assume esi:PTR TVITEM
mov eax,[esi].cChildren
mov nodeChild,eax

test eax,eax
jz @nochild ;it is single item no child

invoke SendMessage,hwndTV,TVM_GETNEXTITEM,TVGN_CHILD,[esi].hItem ;get child item
mov hItem,eax
invoke TreeView_SetCheckState,hwndTreeView,hItem,state ;checkit

;Change state of all siblings
@@:
invoke SendMessage,hwndTV,TVM_GETNEXTITEM,TVGN_NEXT,hItem
test eax,eax
jz @nosibling
mov hItem,eax
invoke TreeView_SetCheckState,hwndTreeView,hItem,state ;checkit
jmp @B

@nosibling:
;invoke SetCheckStateOfChildren,hwndTV,esi,state

@nochild:



ret

SetCheckStateOfChildren endp


I guess I should call this proc inside again but I am not familiar with this stuff.I will appreciate any help.Thanks
Posted on 2002-07-29 10:15:07 by LaptoniC