Forum Discussion

parthkar27's avatar
parthkar27
Occasional Contributor
6 years ago

Significance of the number "1" in code Aliases.dlgAttributeFilter.Window("Button", "OK",1).

Hi,

 

In the following code, can someone please tell me the significance of each parameters?

 

Aliases.dlgAttributeFilter.Window("Button", "OK",1).

As far as my observation, I deduced the line of code as "Window that contains Button named as OK which is postioned as 1"

 

Is it correct?

I even found that, if we dont use the number "1" even then the code runs fine , then what is the importance of adding the using an extra parameter? Because, in one window(active) there will be one OK button. So, even without the number the code would work then, Can you please tell me why do we need the extra parametre of number i.e. "1"?

 

Regards,

Parth

1 Reply

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The "Window" object type in TestComplete is described in https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/desktop/general/window/index.html

     

    Basically, the three fields are, in order from left to right, the WndClass, the WndCaption, and the Index... the number "1" is not position, but an "index" of objects... if there are, for some reason, two objects with the same WndClass and WndCaption, then there would be one with a number 1 and one with a number 2.

     

    The reason why it works fine without the 1 in your example is because there is no other object with that class and caption... so, the index is superfluous.