Problem running Find on untraversed structures
I'm attempting to convert a series of old SQARobot modules over to TestComplete 8, and have run into problems when I try to use the [Window].Find method to get a reference to a child window.
What seems to happen is that Find will only find the child window if it's already been accessed by some earlier script operation.
Here's a sample script routine that demonstrates the problem:
<font class="small">Code:</font><hr /><pre>
' Start app, create new document (and associated editing window)
Call TestedApps.SIGMA.Run(1, True)
Set Sigma = Aliases.SIGMA
' Get reference to document window; _try_ to make sure this is up to date
Set objStart = Aliases.sigma.GUIForm.MDIClient
' Iterate through child windows, possibly accessing contents of each
For i = 0 to objStart.ChildCount - 1
Set objChild = objStart.Child(i)
Log.Message "Child: " '+ CStr(objChild.Enabled)
' Try to find named immediate child of main document window
Set objFound = objStart.Find("zName", "MDIChild", 500)
' Report success or failure
If objFound.Exists Then
If the CStr(objChild.Enabled) access is commented out (as above), the objStart.Find fails. If the access is uncommented, the objStart.Find works.
Background on the application:
<ul type="square">[*]It's written in Delphi 2010[*]The MDIChild window I'm doing the search for is the only child of objStart; it definitely exists at all time, and isn't (within our code) lazy loaded or anything like that[/list]
I suspect I'm missing something pretty fundamental here, but for the life of me can't see what. Any suggestions would be very gratefully received!
Re: Problem running Find on untraversed structures
Try searching for the object using the 'NativeVCLObject.Name' property instead of the 'zName' property and let me know whether this helps.
If this does not help, can you provide us with your application or a sample application demonstrating the problem? If you can, please contact us directly via the Contact Support form.