GetNodeRow Method

Returns the number of a row's parent, first, or last child in an outline.

Syntax

[form!]VSFlexGrid.GetNodeRow(Row As Long, Which As NodeTypeSettings)[ = value As Long ]

Remarks

When the grid is used in outline mode, this method allows you to determine a node's parent, first, or last child nodes.

The parameters for the GetNodeRow property are described below:

Row As Long

The row number of the node whose parent or child nodes you want to determine.

Which As NodeTypeSettings

Which node to return. Valid settings for this parameter are:

 

Constant

Value

Description

FlexNTRoot

0

Returns the index of the node's top level ancestor.

FlexNTParent

1

Returns the index of the node's immediate parent.

FlexNTFirstChild

2

Returns the index of the node's first child node.

FlexNTLastChild

3

Returns the index of the node's last child node.

FlexNTFirstSibling

4

Returns the index of the node's first sibling node (may be same row)

FlexNTLastSibling

5

Returns the index of the node's last sibling node (may be same row)

FlexNTPreviousSibling

6

Returns the index of the node's previous sibling node (-1 if this is the first sibling)

FlexNTNextSibling

7

Returns the index of the node's next sibling node (-1 if this is the last sibling)

 

If the node requested cannot be found, GetNodeRow returns -1. For example, the root node has no parent, and empty nodes have no children.

The code below shows two typical uses for the GetNodeRow property:

    ' traverse an outline and return the full path to a given node

    Private Function GetFullPath(r As Long)

        Dim s$

        While r > -1

            s = fg.TextMatrix(r, 0) & "\" & s

            r = fg.GetNodeRow(r, flexNTParent)

        Wend

        GetFullPath = s

    End Function

    ' delete an outline node and all its children

Private Sub DeleteNode(r As Long)

     Dim nRows&

     nRows = fg.GetOutlineNode(r, flexNTLastChild) - r + 1

     While nRows > 0

         fg.RemoveItem r

         nRows = nRows - 1

     Wend

End Sub

Data Type

Long

See Also

VSFlexGrid Control