1. Iterating Through TreeView Children
- Posted by cklester <cklester at yahoo.com> Jul 11, 2005
- 580 views
Using Win32Lib, how would I iterate through a parent's children? Specifically, a user will click on a parent item and then I need to get its list of children and step through performing actions for each. Thanks! -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/
2. Re: Iterating Through TreeView Children
- Posted by Jonas Temple <jtemple at yhti.net> Jul 11, 2005
- 535 views
CK, If you insert these two routines into Win32Lib.ew right after the deleteItem() routine you will be able to: 1. Get all children of any tree view item 2. Delete children of any tree view item. I thought these might make their way into the official Win32Lib one day, I seem to remember submitting them to Derek. HTH,
--BEG CJT01 ----------------------------------------------------------------------------- --/topic Tree View Control --/func deleteTVChildren( TheTreeView, position ) --/desc Deletes all children at "position" in the /i tree view. -- -- Example: --/code -- atom position -- position = getTVIndex(TheTreeView) -- /deleteTVChildren( TheTreeView, position ) --/endcode global procedure deleteTVChildren( atom id, integer pos ) atom iItem -- Is a treeview? if ctrl_Type[ id ] = TreeView then -- take care of any children iItem = find(pos, tvitem_parent) while iItem do VOID = deleteItem( id, iItem ) iItem = find(pos, tvitem_parent) end while end if end procedure ----------------------------------------------------------------------------- --/topic Tree View Control --/func getTVChildren( TheTreeView, position ) --/desc Returns all child items for the passed item in the /i tree view. -- -- Example: --/code -- atom position -- sequence children -- -- position = getTVIndex(TheTreeView) -- children = /getTVChildren( TheTreeView, position ) --/endcode global function getTVChildren(atom id, integer pos) sequence children children = {} -- Is a treeview? if ctrl_Type[ id ] = TreeView then -- take care of any children for i = 1 to length(tvitem_parent) do if tvitem_owner[i] = id and tvitem_parent[i] = pos then children &= i children &= getTVChildren(id, i) end if end for end if return children end function --END CJT01
Jonas Temple http://www.yhti.net/~jktemple
3. Re: Iterating Through TreeView Children
- Posted by cklester <cklester at yahoo.com> Jul 11, 2005
- 532 views
Jonas Temple wrote: > > If you insert these two routines into Win32Lib.ew right after the deleteItem() > routine > you will be able to: > > 1. Get all children of any tree view item > 2. Delete children of any tree view item. Thanks, Jonas!! I'll give it a test after I get back from lunch. :) -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/