AlexKaras
If it cannot be guaranteed that the value of TabIndex will remain stable, you may consider the approach like this:
-- Search for all buttons within required scope (window/panel/etc.) using the .FindAllChildren() method;
-- Iterate through the returned array and look for the button you need using some other criterion (for example - its caption);
-- Proceed with the found button.
The above approach will work even if TabIndex value changes from run to run. The price that you will pay is decreased performance (because of searching for all buttons and additional filtering) and possible cases with localization (if your application has localizations).
Thank you very much for your reply and information :robothappy:
Yes, I'm also worried about the TabIndex being stable, but it was the only unique property of the object so I figured I would try with that and see where it took me. I think it would work fine if all tests were being run on the one DB, but I'm almost certain it won't be useful across multiple DBs.
I had actually thought about and looked into using the FindAllChildren method. However, where I was getting stuck was with actually returning an array. I wasn't sure which PropName and PropValue to use with the method in order to have anything returned. My first few attempts resulted in blank returns. Do you have any recommendations? Also, how would I go about iterating through the returned array? I really think this will be the way to go, because like you said it will work even if TabIndex changes from run to run. I'm not too concerned about decreased performance because this might be the only option for us to use TestComplete for this particular app (at least across multiple DBs).
Thanks again for the info,
- Allen