Hi,
I am facing a problem in trying to select a checkbox in an ultraWinGrid control (screenshot attached)
The checkbox lies within one of the cells and I am not able to set the checkbox to an On state.
Is there a native method/property which can be used to set the checkbox to a "checked" state?
SwfWindow("xxx").SwfWindow("yyy").SwfTable("zzz").Object.SomeMethod
I'm using QTP 10, Test Advantage 2005 Volume 3 CLR 1.0. Application is coded in c#.
Any help would be appreciated.
Regards,
Chandan
Hi Chandan,
I am assuming that you have NetAdvantage 2005 Volume 3 CLR 1.0 in your application to match your TestAdvantage 2005 Volume 3 CLR 1.0. That being said, it should record and replay:
SetCellData sRowPath, sColumn, sValue
SwfWindow("xxx").SwfWindow("yyy").SwfTable("zzz").SetCellData "4","checkbox","True"
Note that due to the timing of events particular to Checkboxes in the grid, it will only record after you leave the focus of the cell. IE move to another cell, or control.
If for some reason it doesn't record, you can still try to maunally script it, again using the syntax shown above. Let me know if this works for you.
Hi Michael,
I'm now able to set the checkbox in the ultrawingrid. But after I check the checkbox and click OK button to close the window, the application is hanging. I tried workarounds like arrow keys / spacebar (to check), used native object.set property. But for all these scenarios, my application is hanging. However, when I check the checkbox manually and click OK button, application does not hang. I thought this could be because the grid might be having some hidden columns whose values are set along with the checkbox. I checked all the hidden columns and the only column that is changing when we check the checkbox is the checkbox column. I also checked if the grid will allow us to edit or not. I have full permission to edit the checkbox. I have pasted the code I have used. Please let me know if I'm missing something:
SwfWindow("xxx").SwfWindow("yyy").SwfTable("ultraGrid").SetCellData "6","SELECTED_COL","True"
SwfWindow("xxx").SwfWindow("yyy").SwfButton("OK").click
Or
Set o = SwfWindow("xx").SwfWindow("yyy").SwfTable("ultraGrid").Object o.rows.Cells["SELECTED_COL"].Value = TrueSet o = Nothing
I executed the following code to ensure that the user is having edit access to edit the grid
SwfWindow("xxx").SwfWindow("yyy").SwfTable("ultraGrid").ActivateCell "5","SELECTED_COL"CellActivation = SwfWindow("xxx").SwfWindow("yyy").SwfTable("ultraGrid").GetNAProperty("ActiveCell.Column.CellActivation")msgbox CellActivation
I'm getting 0 in CellActivation.
Could you please let me know what could be the reason why the application is hanging, only when we perform the action through the QTP script?
I have done this for infragistics ultragrid as follows:
To get status of Checkbox in cell.....SwfTable("").GetCellData(RowNum,ColNum)
It will return TRUE if checked else FALSE
To set status of Checkbox in cell.....SwfTable("").SetCellData(RowNum,ColNum,TRUE/FALSE)
Hope it will help