How do I find when a row in the GridGroupingControl is Expanded or Collapsed through the test script code?
Helper functions like IsGroupExpanded and IsRecordExpanded determine whether a record row or group caption row in the GridGroupingControl is expanded or collapsed when accessed through test script code. Other relevant functions, such as IsGroupRow and IsRecord, identify whether a given row is a record row or a caption row.
SwfWindow("GridGroupingControl").Activate
'Sets the Current Cell.
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 4,"parentID"
'Expands the Current record.
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"
'Adds the Grouped Columns.
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").GroupBy "ChildTable","Name","Add"
'Expands Group-9.
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandGroup 9
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 11,"childID"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 13,"childID"
'Expands Group-8.
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandGroup 8
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 8,"childID"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 10,"Name"
'Sets Scroll Positions.
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
'Sets Cell data.
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCellData 10,"Name","ChildName0_Modified"
'Checks whether the Record is GroupRow.
If SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").IsGroupRow(8) Then
'Checks whether the Group is Expanded or not.
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
'Checks whether it is a Record row.
If SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").IsRecord(10) Then
'Checks whether the Record is Expanded or not.
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
'Checks for the Collapsed Group.
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