Hi,
I am working on .Net Window Application Automation by Using UFT11.53 + TestAdvanatge10.2 (Product Version: 10.2.20102.2023 ).
Please let us know how to get text color (fore color) of UltraWinGrid cell.
I tired with below line of code, but it doesn't worked (Returning Empty).
Hi Guru,
Thank you for contacting Infragistics Developer Support.
Please try the following method and let me know if you are able to get the appearance this way:
SwfWindow("Form1").SwfTable("ultraGrid1").GetCellAppearance(rowIndex,colIndex,appForeColor)
If not you can get the appearance using the GetNAProperty. This requires knowledge of how the application itself can set the appearance. One example of a possible approach would be to use:
SwfWindow("Form1").SwfTable("ultraGrid1").GetNAProperty(“DisplayLayout.Override.CellAppearance.ForeColor”)
Hi Dimitar,
Thanks,I Worked on below methods as you suggested and it doesn't worked as expected.
Method-1:
msgbox SwfWindow("swfname:=frmMrm").SwfWindow("swfname:=frmment").SwfWindow("swfname:=frmAssent_11").SwfTable("swfname:=ugMns").GetCellAppearance(2,2,appForeColor) Above Code throwing an error : Object doesn't support this property or method: 'GetCellAppearance'
Method-2:
msgbox SwfWindow("swfname:=frmMnForm").SwfWindow("swfname:=frmAment").SwfWindow("swfname:=frmAssessment_11").SwfTable("swfname:=ugPEGU").GetNAProperty("DisplayLayout.Override.CellAppearance.ForeColor")
Above code returning as R=0, G=0, B=0
The Scenario is UltraGrid Cells having Static Text, which colors will be change dynamically (if check box is checked color turned to Yellow and if we Unchecked color turned to Black).
Please let us know if anything additional information required from my side?
Thanks,
Guru
Hello ,
GetCellAppearance(….) method was introduced within the release of Infragistics TestAdvantage Windows Forms for HP 10.3, and tha is why you are getting this message when you try to use it.
About second approach:
The returned result shows that foreColor has its defeat value, i.e. no foreColor was set to “DisplayLayout.Override.CellAppearance.ForeColor” (which actually is the cell appearance for all cells of the grid). So in order to use this approach you should know the exact appearance object on which foreColor was applied. Can you confirm that your application apples fore color to UltraGrid.DisplayLayout.Ovveride.CellAppearance.ForeColor or this color was applied on cell, column or row level ?
Please let me know if you have any further questions.
Hi Hristo.
As i confirmed with developer they are not using Override method. They are assigning color to Cell text.
And, the color was applied on Cell. let us know the method to get cell color text.
Please let me know if you need any additional information?
Guru.
Thank you for the reply.
If the cell color is changed directly on the cells themselves, you could use the following code to get the text color:
msgbox SwfWindow("swfname:=frmMnForm").SwfWindow("swfname:=frmAment").SwfWindow("swfname:=frmAssessment_11").SwfTable("swfname:=ugPEGU").GetNAProperty("Rows["&rowIndex&”].Cells[“&colIndex&”].Appearance.ForeColor”)
Where rowIndex and colIndex are the indexes of the row and the column respectively.
Keep in mind that depends on the exact way the developers are setting the color of cells and in your case it may differ. So please communicate with your developers the exact way and code that they use in order to set the cell color. You can use that code in the GetNAProperty method in order to retrieve the respective property.
Please let me know if you have any additional questions.
Thanks,Dimita.
Now able to get cell forecolor.
Thanks for you support.
Hi ,I am using the above code to get the colour of row using lean ft but not getting the colour.