Paul and Eyvind,
Thought this may  amuse you.

Recursion is best explained by the following anecdote:

A theoretical mathemetician is suprised one day to find his desk on
fire.  He runs to the extinguisher and douses the flames.

The next day he looks up from his book to see that his wastepaper
basket is on fire.  Quickly he takes the basket and empties it onto his
desk which begins to burn.

Having thus reduced the problem to one he has already solved, he goes
back to his reading. 


Dave Crozier
 The secret to staying young is to live honestly, eat slowly, and to lie
about your age 

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Paul Newton
Sent: 09 October 2006 11:11
To: [email protected]
Subject: Re: Walk the treeview - Soluton

Eyvind Axelsen wrote:
> This sounds like a typical application for a recursive procedure that
walks the child nodes of a given node. If you have a limited amount of items
and are using VFP9, you can use increase the STACKSIZE parameter in your
config.fpw file. It's a shame that the fox is not better suited for
recursivity.
>
> Good luck!
>
> Eyvind.
>
>   
OK - got it:

PARAMETERS nodeParent

*!* Walks the specified source parent treeview node,
*!* and all of its children nodes
*!*
*!* nodeParent: parent node to walk

LOCAL nodeChild As Node

nodeParent.Selected = .T.
WAIT WINDOW TIMEOUT 1

*!* Get the current parent node's first child nodeChild = nodeParent.Child

*!* Now walk through the current parent node's children

DO WHILE Not ISNULL(nodeChild)

    *!* If the current child node has its own children...
    If nodeChild.Children > 0

        *!* Recursively DO this proc walking the child node
        *!* (which becomes the new parent node)
        THISFORM.WalkTree(nodeChild)

    Else

        *!* Process the child node
        nodeChild.Selected = .T.
        WAIT WINDOW TIMEOUT 1

    ENDIF

    *!* Get the current child node's next sibling
    nodeChild = nodeChild.Next

ENDDO

RETURN





[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to