Forum Discussion

HBeurdouche's avatar
HBeurdouche
New Contributor
13 years ago

How to get Child object of an object coming from FindChild function

Hi,



I want to find an object which always contains a specific "MainFrame" string in its name,

and call its child objects.

I use FindChild function in Jscript.


PropNames = Array("MappedName","Exists");


PropValues = Array("*MainFrame*","true");


mainFrame = MainObject.FindChild(PropNames,PropValues,2);


It returns an object, which has several properties and exists,


But it is not possible to call childs objects of mainFrame.

childObject = mainFrame.ChildObject ; I have a message telling ChildObject has not been found

But object bowser or Inspect shows this object exists.



It happens even if they are mapped in NameMapping and Required Chidren.


If I redo FindChild operation on the mainFrame child objects,

the object it finds is empty, it has not even Exists property set to false.


Thanks a lot.

3 Replies

  • Hello Heloise,


    To help us find the cause of the problem, could you please check the following?

    1. Does the FindChild method return a correct MainFrame object that has the needed child objects? Is the ChildCount property of the result object greater than zero?

    2. Do the parameters you use in the FindChild method to obtain the MainFrame object identify the object uniquely?

    3. How do you obtain the MainFrame object's child objects? Do you address them by their names or mapped names? Have you tried obtaining them by using the Child, WaitChild or WaitNamedChild method?

    4. What parameters do you use to obtain the MainFrame object's child objects by using the FindChild method?

    Thank you.

  • Hello Julia,



    sorry for the late answer,



    1. Does the FindChild method return a correct MainFrame object that has the needed child objects? Is the ChildCount property of the result object greater than zero?



    -The object has not all the child objects, it has only those which are also in the properties

    -ChildCount is greater than zero (same as in ObjectBrowser)



    2. Do the parameters you use in the FindChild method to obtain the MainFrame object identify the object uniquely?



    -yes (I move to ClrFullName and Exists properties)



    3. How do you obtain the MainFrame object's child objects? Do you address them by their names or mapped names? Have you tried obtaining them by using the Child, WaitChild or WaitNamedChild method?



    -I redo a FindChild operation

    -MappedName and Exists properties (wildcards in MappedName)

    -I tried with waitChild method and I had the same problem

    4. What parameters do you use to obtain the MainFrame object's child objects by using the FindChild method?


    PropNames = Array("MappedName","Exists");


    PropValues = Array("*ClrUiTreeCtrlInput*","true");


    clrUiTreeCtrlInput = MainObject.FindChild(PropNames,PropValues,4);



    I found a way to solve my problem: I used NameMapping

    I improved the NameMapping criteria for the MainFrame Object and I do not need anymore a findchild to catch the MainFrame Object,

    it has the needed child object, methods etc ...

  • Hello Heloise,

    Thank you for your response and for the details. I'm glad to know that you have already found a solution for your problem.

    If you encounter the same problem with the FindChild method once again, please try to use a different set of properties to do the search or increase the number of used properties. If this does not help, please contact us via this forum or via the Contact Support web form and send us the problematic project suite so that we could reproduce the problem.

    Thank you.