On Thu, Jan 24, 2013 at 10:24 AM, Staffan Tylen <staffan.tylen@gmail.com> wrote:

Mark, no problem, I can wait. Here is a sample program, and as you can see the items are identical. Right-click an item to delete.


There is probably some confusion in terminology here.  I took  a look at the MSDN docs on the tree-view and they say for the root:

"the topmost or very first item of the tree-view control."

So, in your example, this insert creates the 'root'

  p1 = tree~insert("ROOT", , "Root1", , , "EXPANDED", .TRUE)

this insert:

  p1 = tree~insert("ROOT", , "Root2", , , "EXPANDED", .TRUE)

does not create "the root", or even "a" root.  It creates a parent item with no connection to "the root".  The find() method starts at the top of "the root" and searches recursively down through all of its children.  There is no connection between "the root" and your parent item with the label 'Root2' so no child items of that parent item are searched.

I don't see any good way in the Windows API to search through all the items in the tree-view if you create unconnected parent items as you do in your example.  

The Rexx find() method could be enhanced to take a optional second item that specifies the parent to start the search with.  If omitted the search would start with "the root" as it does now.  If specified it would start with the item specified and recursively search all its children.

You would need to keep track of your disconnected parent items in your program and search the Root2 and Root3 parents individually after you searched "the root."

Mark Miesfeld