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
120
How to uniquely identify grids in differnet window panes?
posted

Hi,

I am facing problem with unique identification of ultragrid row in different window panes. I have to get the count of columns of the grid. These column counts vary in each window pane.

For example if I activate pane A, number of columns in the grid of this pane is 10 and number of columns in the grid of pane B is 15

While recodring any action on this grid following line is generated

msgbox SwfWindow("Phoenix").SwfTable("ultraGrid").ColumnCount

After this following line is used to activate the pane B

SwfWindow("Phoenix").SwfObject("SwfObject").PaneActivate "B"

Now I want to get the column count of the grid of Pane B

and using the same line as above i.e msgbox SwfWindow("Phoenix").SwfTable("ultraGrid").ColumnCount

Problem is that result is same for both the counts though 15 is expected in the second message box as

I have activated pane B and now want the column count of the grid's row in this pane.


Any pointer to solve this issue will be highly appreciated

Harsh

  • 310
    posted

    Hi,

    I am working on an application that has about 100 grids(!) and I have always found that the best way to identify each grid individually is to make sure the 'swfname path' property is included in the object repository as that always seems to be unique for each grid. If that is the case in your app, and you do not have this property in the repository for the grid then you will then have to create a definition for each of the two tables...so you end up with 'ultraGrid' & 'ultraGrid2' for example.

    If the swfname path is the same for both grids (not sure if this is possible, but I have never yet seen that), then I guess you will need to use an index reference...but the fact that QTP goes to your first table all the time, suggests that there IS some distinguishing property in the repository that you haven't noticed yet, as QTP will usually just hang there if it is asked to interact with a control where there are two identical instances and no index has been provided. It sounds to me like you just need to add the grid in pane B to the repository and then just modify the line of code you use to get a count from it so that the name is correct.

    Cheers, Ryan