I'm using QTP 9.2 with TestAdvantage 2006 v2 CLR 1.x and I would like to know how I can determine if a cell in an UltraGrid has a status of "Allow Edit" or "No Edit". Certain cells in the grid of our application should have a status of "Allow Edit" all of the time, while other cells should have a status of "No Edit" only in certain instances, so I'm trying to check those in my test scripts.
I've spied on the grid with the .Net Object Spy and found the following: Display Layout > Bands > 0 > Columns > (Column Name) > Row Layout Column Info > Column > Cell Activation > AllowEdit, which I assume is the property I'm needing, but I'm not sure of the syntax for my test scripts to return that property. Here is an example of my scripts, but I'm obviously doing something wrong as when I message box the second line, I get an empty message:
SwfWindow("Company Name").SwfWindow("Purchase Order for Branch").SwfTable("ultraGrid1").ActivateCell "0","QuantityReceived"
SwfWindow("Company Name").SwfWindow("Purchase Order for Branch").SwfTable("ultraGrid1").GetROProperty ("CellActivation", "AllowEdit")
I've only been using TestAdvantage with QTP for about a year, so any help will be appreciated. Thank you!
Hi Dennis,
Use the following line after "ActivateCell" method call
CellActivation = SwfWindow("Company Name").SwfWindow("Purchase Order for Branch").SwfTable("ultraGrid1").GetNAProperty("ActiveCell.Column.CellActivation")
This return an Enumeration as follow:
AllowEdit = 0,
ActivateOnly = 1,
Disabled = 2,
NoEdit = 3,
Hope that is helpful.
Regards,
Ammar
I am also trying to leverage the solution to extract the state of the cell in ultragrid after activating the concerned cell
oGrid.GetNAProperty("ActiveCell.Column.CellActivation")
However, getting an error:
Hi Amar, I wanted to add a "Selected" Boolean column to my WinGrid (2008vol3) and set its property to AllowEdit but make all other columns (= bounded while "Selected" column is not) readonly.
With this way I want to let the user choose if he selects the rows by clicking on the checkbox in the Selected column or the usual Windows selection type (with shift and ctrl). But now I can't check or uncheck the checkboxes in the "Selected" Column.
Can you help me?
Andy
Hi Ammar,
That worked like a charm. Thank you for your help!
Dennis