Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
310
Using the 'Object' model to retrieve properties of controls
posted

Hi,

My question is quite general, but stems from another question that Michael answered for me. Giving two examples from Michael, there seems to be two ways you can access the value in a cell within an Infragistics grid:

By using the 'Object' model: 

grid.Rows.GetItems(parentRowNum).ChildBands(childBandIndex).Rows.GetItems(childRowNum).Cells.GetItem(cellNum).Value

Alternatively you can use GetCellData supplied with TestAdvantage which uses the same variables that is used with ActivateCell and SelectCell:

MsgBox SwfWindow("Some Window").SwfTable("grid").GetCellData("10", "some column name")

Where can I find comprehensive information about using the 'object' model in QTP..I would never have guessed the syntax in the first example above unless someone had told me it. I have noticed that if you use the .NET Windows Forms Spy tool, the listed properties appear to help with the syntax, for example, I retrieved the Back Color of a combobox by using the code SwfWindow("Some Window").SwfComboBox("cbo").Object.Appearance.BackColor. Does the .NET Windows Forms Spy cover ALL possible syntax possibilities? and how would it have helped me consturct the code in the first example? The help file that comes with TestAdvantage doesn't have much in the way of examples!

The reason I am asking is that it seem the first method would provide a more powerful toolset in getting to properties of a control that may not be easy using the 'simpler' second example.

Cheers, Ryan

  • 7695
    Offline posted

     The Object property off of any QuickTest Professional Object, does just that, it retreives the .NET object that the QTP is refering to. In the case of the above sample it refers to the UltraWinGrid. If you have access to the NetAdvantage product, you should also have access to the help that goes with it and access it on your machine. Otherwise you are free to use our online help that is built from the same files at the link below: http://es.infragistics.com/support/documentation.aspx#OnlineDocumentation

    Two things to keep in mind, first you cannot directly access an indexed property such as myArray[2], but you can, as I have done in the above example use methods that return a value. Such as GetItem(index) .The second is in this context you do not need to cast any object into it's type to use it, but you will not have intellisense for anything past the first level. Hence you need to use the help to determine the object model. 

     

    I hope this helps answer your question,