Forum Discussion

Natasha_2012's avatar
Natasha_2012
Contributor
8 years ago
Solved

how to get a component object of an object hierarchy without knowing its depth in the hierarchy

I have a window object.  This window object contains a hierarchy of its components.  It can be many levels which I dont know as it can be change during run time, depending on the input. I want to retrieve a component object.  I know its property name and its value, but I dont know its depth in that hierarchy, but I know it will always be there.  How do I retrieve this object please?  Thanks heaps

  • You can use some quasi-maximum value e.g. 100

    Another way is to map your element using extended search feature.

  • As baxatob says, just make the depth value of the search huge.

     

    Of course, if you search through a large object hierarchy, with many child objects of child object etc etc, this can come with a considerable performance hit.

     

    If possible you're always best to start the search as close to the target object as you possibly can.

     

    Using extended find doesn't get round this as it if can't find it initially, it just kicks off a search of the object hierarchy to try and find it .... and you're back to taking the performance hit for it.

2 Replies

  • baxatob's avatar
    baxatob
    Community Hero

    You can use some quasi-maximum value e.g. 100

    Another way is to map your element using extended search feature.

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      As baxatob says, just make the depth value of the search huge.

       

      Of course, if you search through a large object hierarchy, with many child objects of child object etc etc, this can come with a considerable performance hit.

       

      If possible you're always best to start the search as close to the target object as you possibly can.

       

      Using extended find doesn't get round this as it if can't find it initially, it just kicks off a search of the object hierarchy to try and find it .... and you're back to taking the performance hit for it.