Developer

API Reference

TraverseDesc

Brew Release
Brew MP 1.0.2
See Also
PFNVISIT EVT_WDG_TRAVERSE IWidget_TraverseContainerTree()
Description
This data type supplies the necessary information for the EVT_WDG_TRAVERSE event, which is used to walk the container tree
Members
  • pfnVisit:      Pointer to a callback function to execute on each widget.
  • pvVisit:       Callback function context pointer.
  • wDepth:        The number of levels to descend on traversal. Use value 0 
                      to descend into the maximum depth of the tree.
  • wReserved:     This member is reserved for use by the EVT_WDG_TRAVERSE event.
Definition
   typedef struct {
      PFNVISIT       pfnVisit;
      void *         pvVisit;
      uint16         wDepth;
      uint16         wReserved;
   } TraverseDesc;
Comment
This event performs a preorder traversal of the container tree. Starting at the target container, each widget is 'visited' by calling the callback function with the widget pointer as a parameter. Then, if the 'wDepth' member allows for it, the container's child widgets are each visited in turn, descending to the depth specified by 'wDepth'.
Example -- given the tree:
   
   
            a  ......... wDepth = 1
          /   \
        b       c ...... wDepth = 2
       / \     / \
      d   e   f   g .... wDepth = 3
   

Where 'a' is the eldest parent container widget which receives the EVT_WDG_TRAVERSE event, the nodes will be visited in the following order: a, b, d, e, c, f, g.
The eldest container widget is at depth one, so passing the value of one for 'wDepth' will visit the same container only and will not descend into any children. The value zero for 'wDepth' is treated as a special case and is used to descend into all levels of the tree.
Using this method to broadcast events and properties to child widgets is the preferred method. For example, if 'a' wants to tell all his children to change their border color to blue, then pfnVisit should set each child's border color to blue as it visits each of them.
  • Follow