How to find whether a row in the GridGroupingControl is expanded or collapsed through test script code?
The helper functions such as IsGroupExpanded, IsRecordExpanded will be helpful in knowing these status. The other related functions are IsGroupRow and IsRecord, helps to find whether a row is a record row or a caption row.
VB
SwfWindow("GridGroupingControl").Move 405,287
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 4,"parentID"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandRecord 4
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 10,"childID"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandRecord 10
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").MouseDown 6,"Name","Left"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 10,"childID"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").GroupBy "ChildTable","Name","Add"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandGroup 9
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 11,"childID"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 13,"childID"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandGroup 8
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 8,"childID"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 10,"Name"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetScrollPosition 80,18
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetScrollPosition 84,18
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetScrollPosition 84,18
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetScrollPosition 85,18
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCellData 10,"Name","ChildName0_Modified"
If SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").IsGroupRow(8) Then
If SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").IsGroupExpanded(8) Then
MsgBox "Row 8 is found to be a Caption and is expanded"
Else
MsgBox "Row 8 is found to be a Caption and is Collapsed"
End If
End If
If SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").IsRecord(10) Then
If SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").IsRecordExpanded(10) Then
MsgBox "Row 10 is found to be a Record and is expanded"
Else
MsgBox "Row 10 is found to be a Record and is Collapsed"
End If
End If
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").CollapseGroup 5
If SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").IsGroupRow(5) Then
If SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").IsGroupExpanded(5) Then
MsgBox "Row 5 is found to be a Caption and is expanded"
Else
MsgBox "Row 5 is found to be a Caption and is Collapsed"
End If
End If