There are many scenarios when we need functions like this. We decided not to bloat the control by implementing all these functions as they can be easily coded using the existing basic members like RowLevel.
Below is one of possible implementations of the RowHasVisibleChildren function that can be used as a basis to implement similar functionality:
Private Function RowHasVisibleChildren(ByVal poGrid As iGrid, ByVal plRow As Long) As Boolean
Dim iRow As Long
Dim btLevel As Byte
btLevel = poGrid.RowLevel(plRow)
iRow = plRow + 1
Do While iRow <= poGrid.RowCount
Select Case poGrid.RowLevel(iRow)
Case Is <= btLevel
' No more children
RowHasVisibleChildren = False
Exit Function
Case btLevel + 1
' A child row of the specified row
If poGrid.RowVisible(iRow) Then
RowHasVisibleChildren = True
Exit Function
End If
End Select
' Next row
iRow = iRow + 1
Loop
RowHasVisibleChildren = False
End Function
An example of calling that detects whether the 3rd row of iGrid1 has visible child rows:
Debug.Print RowHasVisibleChildren(iGrid1, 3)
Edited by user
2018-12-21T15:58:32Z
|
Reason: Not specified