# lv_obj_tree.h (/api/core/lv_obj_tree_h)



<ApiSummary functions="27" enums="1" typedefs="1" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (3)&#x22;,&#x22;Getters (14)&#x22;,&#x22;Other (10)&#x22;]">
  <ApiTab value="Setters (3)">
    <ApiMember kind="function" name="lv_obj_set_parent" file="core/lv_obj_tree.h" line="83" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L83">
      lv_obj_set_parent [#lv_obj_set_parent]

      Move the parent of an object. The relative coordinates will be kept.

      ```c title=" " lineNumbers=1
      void lv_obj_set_parent(lv_obj_t *obj, lv_obj_t *parent)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name     | Type                                             | Description                                           |
      | -------- | ------------------------------------------------ | ----------------------------------------------------- |
      | `obj`    | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object whose parent needs to be changed |
      | `parent` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to the new parent                             |
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_set_name" file="core/lv_obj_tree.h" line="212" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L212">
      lv_obj_set_name [#lv_obj_set_name]

      Set a name for a widget. The name will be allocated and freed when the widget is deleted or a new name is set.

      ```c title=" " lineNumbers=1
      void lv_obj_set_name(lv_obj_t *obj, const char *name)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                                             | Description                                                                           |
      | ------ | ------------------------------------------------ | ------------------------------------------------------------------------------------- |
      | `obj`  | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object                                                                  |
      | `name` | `const char *`                                   | the name to set. If set to `NULL` the default "\<widget\_type>\_#" name will be used. |

      <Callout type="info">
        If the name ends with a `#`, older siblings with the same name will be counted, and the `#` will be replaced by the index of the given widget. For example, creating multiple widgets with the name "mybtn\_#" will result in resolved names like "mybtn\_0", "mybtn\_1", "mybtn\_2", etc. The name is resolved when `lv_obj_get_name_resolved` is called, so the result reflects the currently existing widgets at that time.
      </Callout>
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_set_name_static" file="core/lv_obj_tree.h" line="227" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L227">
      lv_obj_set_name_static [#lv_obj_set_name_static]

      Set a name for a widget. Only a pointer will be saved.

      ```c title=" " lineNumbers=1
      void lv_obj_set_name_static(lv_obj_t *obj, const char *name)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                                             | Description                                                                           |
      | ------ | ------------------------------------------------ | ------------------------------------------------------------------------------------- |
      | `obj`  | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object                                                                  |
      | `name` | `const char *`                                   | the name to set. If set to `NULL` the default "\<widget\_type>\_#" name will be used. |

      <Callout type="info">
        If the name ends with a `#`, older siblings with the same name will be counted, and the `#` will be replaced by the index of the given widget. For example, creating multiple widgets with the name "mybtn\_#" will result in resolved names like "mybtn\_0", "mybtn\_1", "mybtn\_2", etc. The name is resolved when `lv_obj_get_name_resolved` is called, so the result reflects the currently existing widgets at that time.
      </Callout>
    </ApiMember>
  </ApiTab>

  <ApiTab value="Getters (14)">
    <ApiMember kind="function" name="lv_obj_get_screen" file="core/lv_obj_tree.h" line="108" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L108">
      lv_obj_get_screen [#lv_obj_get_screen]

      Get the screen of an object

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_obj_get_screen(const lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description          |
      | ----- | ------------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to an object |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to the object's screen
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_display" file="core/lv_obj_tree.h" line="115" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L115">
      lv_obj_get_display [#lv_obj_get_display]

      Get the display of the object

      ```c title=" " lineNumbers=1
      lv_display_t * lv_obj_get_display(const lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description          |
      | ----- | ------------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to an object |

      **Returns:** <ApiLink name="lv_display_t" display="lv_display_t *" /> — pointer to the object's display
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_parent" file="core/lv_obj_tree.h" line="122" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L122">
      lv_obj_get_parent [#lv_obj_get_parent]

      Get the parent of an object

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_obj_get_parent(const lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description          |
      | ----- | ------------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to an object |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — the parent of the object. (NULL if `obj` was a screen)
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_child" file="core/lv_obj_tree.h" line="135" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L135">
      lv_obj_get_child [#lv_obj_get_child]

      Get the child of an object by the child's index.

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_obj_get_child(const lv_obj_t *obj, int32_t idx)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description                                                                                                                                             |
      | ----- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to an object whose child should be get                                                                                                          |
      | `idx` | <ApiLink name="int32_t" />                             | the index of the child. 0: the oldest (firstly created) child 1: the second oldest child count-1: the youngest -1: the youngest -2: the second youngest |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to the child or NULL if the index was invalid
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_child_by_type" file="core/lv_obj_tree.h" line="149" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L149">
      lv_obj_get_child_by_type [#lv_obj_get_child_by_type]

      Get the child of an object by the child's index. Consider the children only with a given type.

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_obj_get_child_by_type(const lv_obj_t *obj, int32_t idx, const lv_obj_class_t *class_p)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name      | Type                                                               | Description                                                                                                                                             |
      | --------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | `obj`     | <ApiLink name="lv_obj_t" display="const lv_obj_t *" />             | pointer to an object whose child should be get                                                                                                          |
      | `idx`     | <ApiLink name="int32_t" />                                         | the index of the child. 0: the oldest (firstly created) child 1: the second oldest child count-1: the youngest -1: the youngest -2: the second youngest |
      | `class_p` | <ApiLink name="lv_obj_class_t" display="const lv_obj_class_t *" /> | the type of the children to check                                                                                                                       |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to the child or NULL if the index was invalid
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_sibling" file="core/lv_obj_tree.h" line="163" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L163">
      lv_obj_get_sibling [#lv_obj_get_sibling]

      Return a sibling of an object

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_obj_get_sibling(const lv_obj_t *obj, int32_t idx)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description                                                                                                                         |
      | ----- | ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to an object whose sibling should be get                                                                                    |
      | `idx` | <ApiLink name="int32_t" />                             | 0: `obj` itself -1: the first older sibling -2: the next older sibling 1: the first younger sibling 2: the next younger sibling etc |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to the requested sibling or NULL if there is no such sibling
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_sibling_by_type" file="core/lv_obj_tree.h" line="177" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L177">
      lv_obj_get_sibling_by_type [#lv_obj_get_sibling_by_type]

      Return a sibling of an object. Consider the siblings only with a given type.

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_obj_get_sibling_by_type(const lv_obj_t *obj, int32_t idx, const lv_obj_class_t *class_p)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name      | Type                                                               | Description                                                                                                                         |
      | --------- | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
      | `obj`     | <ApiLink name="lv_obj_t" display="const lv_obj_t *" />             | pointer to an object whose sibling should be get                                                                                    |
      | `idx`     | <ApiLink name="int32_t" />                                         | 0: `obj` itself -1: the first older sibling -2: the next older sibling 1: the first younger sibling 2: the next younger sibling etc |
      | `class_p` | <ApiLink name="lv_obj_class_t" display="const lv_obj_class_t *" /> | the type of the children to check                                                                                                   |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to the requested sibling or NULL if there is no such sibling
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_child_count" file="core/lv_obj_tree.h" line="185" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L185">
      lv_obj_get_child_count [#lv_obj_get_child_count]

      Get the number of children

      ```c title=" " lineNumbers=1
      uint32_t lv_obj_get_child_count(const lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description          |
      | ----- | ------------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to an object |

      **Returns:** <ApiLink name="uint32_t" /> — the number of children
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_child_count_by_type" file="core/lv_obj_tree.h" line="194" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L194">
      lv_obj_get_child_count_by_type [#lv_obj_get_child_count_by_type]

      Get the number of children having a given type.

      ```c title=" " lineNumbers=1
      uint32_t lv_obj_get_child_count_by_type(const lv_obj_t *obj, const lv_obj_class_t *class_p)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name      | Type                                                               | Description                       |
      | --------- | ------------------------------------------------------------------ | --------------------------------- |
      | `obj`     | <ApiLink name="lv_obj_t" display="const lv_obj_t *" />             | pointer to an object              |
      | `class_p` | <ApiLink name="lv_obj_class_t" display="const lv_obj_class_t *" /> | the type of the children to check |

      **Returns:** <ApiLink name="uint32_t" /> — the number of children
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_name" file="core/lv_obj_tree.h" line="234" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L234">
      lv_obj_get_name [#lv_obj_get_name]

      Get the set name as it was set.

      ```c title=" " lineNumbers=1
      const char * lv_obj_get_name(const lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description          |
      | ----- | ------------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to an object |

      **Returns:** `const char *` — get the set name or NULL if it wasn't set yet
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_name_resolved" file="core/lv_obj_tree.h" line="249" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L249">
      lv_obj_get_name_resolved [#lv_obj_get_name_resolved]

      Get the set name or craft a name automatically.

      ```c title=" " lineNumbers=1
      void lv_obj_get_name_resolved(const lv_obj_t *obj, char buf[], size_t buf_size)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name       | Type                                                   | Description                     |
      | ---------- | ------------------------------------------------------ | ------------------------------- |
      | `obj`      | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to an object            |
      | `buf`      | `char`                                                 | buffer to store the name        |
      | `buf_size` | <ApiLink name="size_t" />                              | the size of the buffer in bytes |

      <Callout type="info">
        If the name ends with a `#`, older siblings with the same name will be counted, and the `#` will be replaced by the index of the given widget. For example, creating multiple widgets with the name "mybtn\_#" will result in resolved names like "mybtn\_0", "mybtn\_1", "mybtn\_2", etc. The name is resolved when `lv_obj_get_name_resolved` is called, so the result reflects the currently existing widgets at that time.
      </Callout>
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_child_by_name" file="core/lv_obj_tree.h" line="276" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L276">
      lv_obj_get_child_by_name [#lv_obj_get_child_by_name]

      Get an object by name. The name can be a path too, for example "main\_container/lv\_button\_1/label". In this case the first part of the name-path should be the direct child of the parent, the second part, should the direct child of first one, etc.

      If the name of a widget was not set a name like "lv\_button\_1" will be created for it using `lv_obj_get_name_resolved`.

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_obj_get_child_by_name(const lv_obj_t *parent, const char *name_path)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name        | Type                                                   | Description                              |
      | ----------- | ------------------------------------------------------ | ---------------------------------------- |
      | `parent`    | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | the widget where the search should start |
      | `name_path` | `const char *`                                         |                                          |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — the found widget or NULL if not found.
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_index" file="core/lv_obj_tree.h" line="287" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L287">
      lv_obj_get_index [#lv_obj_get_index]

      Get the index of a child.

      ```c title=" " lineNumbers=1
      int32_t lv_obj_get_index(const lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description          |
      | ----- | ------------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to an object |

      **Returns:** <ApiLink name="int32_t" /> — the child index of the object. E.g. 0: the oldest (firstly created child). (-1 if child could not be found or no parent exists)
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_get_index_by_type" file="core/lv_obj_tree.h" line="297" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L297">
      lv_obj_get_index_by_type [#lv_obj_get_index_by_type]

      Get the index of a child. Consider the children only with a given type.

      ```c title=" " lineNumbers=1
      int32_t lv_obj_get_index_by_type(const lv_obj_t *obj, const lv_obj_class_t *class_p)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name      | Type                                                               | Description                       |
      | --------- | ------------------------------------------------------------------ | --------------------------------- |
      | `obj`     | <ApiLink name="lv_obj_t" display="const lv_obj_t *" />             | pointer to an object              |
      | `class_p` | <ApiLink name="lv_obj_class_t" display="const lv_obj_class_t *" /> | the type of the children to check |

      **Returns:** <ApiLink name="int32_t" /> — the child index of the object. E.g. 0: the oldest (firstly created child with the given class). (-1 if child could not be found or no parent exists)
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (10)">
    <ApiMember kind="function" name="lv_obj_delete" file="core/lv_obj_tree.h" line="46" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L46">
      lv_obj_delete [#lv_obj_delete]

      Delete an object and all of its children. Also remove the objects from their group and remove all animations (if any). Send `LV_EVENT_DELETE` to deleted objects.

      ```c title=" " lineNumbers=1
      void lv_obj_delete(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description          |
      | ----- | ------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object |
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_clean" file="core/lv_obj_tree.h" line="54" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L54">
      lv_obj_clean [#lv_obj_clean]

      Delete all children of an object. Also remove the objects from their group and remove all animations (if any). Send `LV_EVENT_DELETE` to deleted objects.

      ```c title=" " lineNumbers=1
      void lv_obj_clean(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description          |
      | ----- | ------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object |
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_delete_delayed" file="core/lv_obj_tree.h" line="61" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L61">
      lv_obj_delete_delayed [#lv_obj_delete_delayed]

      Delete an object after some delay

      ```c title=" " lineNumbers=1
      void lv_obj_delete_delayed(lv_obj_t *obj, uint32_t delay_ms)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name       | Type                                             | Description                                |
      | ---------- | ------------------------------------------------ | ------------------------------------------ |
      | `obj`      | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object                       |
      | `delay_ms` | <ApiLink name="uint32_t" />                      | time to wait before delete in milliseconds |
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_delete_anim_completed_cb" file="core/lv_obj_tree.h" line="67" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L67">
      lv_obj_delete_anim_completed_cb [#lv_obj_delete_anim_completed_cb]

      A function to be easily used in animation ready callback to delete an object when the animation is ready

      ```c title=" " lineNumbers=1
      void lv_obj_delete_anim_completed_cb(lv_anim_t *a)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name | Type                                               | Description              |
      | ---- | -------------------------------------------------- | ------------------------ |
      | `a`  | <ApiLink name="lv_anim_t" display="lv_anim_t *" /> | pointer to the animation |
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_delete_async" file="core/lv_obj_tree.h" line="75" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L75">
      lv_obj_delete_async [#lv_obj_delete_async]

      Helper function for asynchronously deleting objects. Useful for cases where you can't delete an object directly in an `LV_EVENT_DELETE` handler (i.e. parent).

      ```c title=" " lineNumbers=1
      void lv_obj_delete_async(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description      |
      | ----- | ------------------------------------------------ | ---------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | object to delete |

      **See also:** <ApiLink name="lv_async_call" />
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_swap" file="core/lv_obj_tree.h" line="91" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L91">
      lv_obj_swap [#lv_obj_swap]

      Swap the positions of two objects. When used in listboxes, it can be used to sort the listbox items.

      ```c title=" " lineNumbers=1
      void lv_obj_swap(lv_obj_t *obj1, lv_obj_t *obj2)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                                             | Description                  |
      | ------ | ------------------------------------------------ | ---------------------------- |
      | `obj1` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to the first object  |
      | `obj2` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to the second object |
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_move_to_index" file="core/lv_obj_tree.h" line="101" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L101">
      lv_obj_move_to_index [#lv_obj_move_to_index]

      moves the object to the given index in its parent. When used in listboxes, it can be used to sort the listbox items.

      ```c title=" " lineNumbers=1
      void lv_obj_move_to_index(lv_obj_t *obj, int32_t index)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                             | Description                                    |
      | ------- | ------------------------------------------------ | ---------------------------------------------- |
      | `obj`   | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to the object to be moved.             |
      | `index` | <ApiLink name="int32_t" />                       | new index in parent. -1 to count from the back |

      <Callout type="info">
        to move to the background: lv\_obj\_move\_to\_index(obj, 0)
      </Callout>

      <Callout type="info">
        to move forward (up): lv\_obj\_move\_to\_index(obj, lv\_obj\_get\_index(obj) - 1)
      </Callout>
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_find_by_name" file="core/lv_obj_tree.h" line="262" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L262">
      lv_obj_find_by_name [#lv_obj_find_by_name]

      Find a child with a given name on a parent. This child doesn't have to be the direct child of the parent. First direct children of the parent will be checked, and the direct children of the first child, etc. (Breadth-first search).

      If the name of a widget was not set a name like "lv\_button\_1" will be created for it using `lv_obj_get_name_resolved`.

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_obj_find_by_name(const lv_obj_t *parent, const char *name)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name     | Type                                                   | Description                              |
      | -------- | ------------------------------------------------------ | ---------------------------------------- |
      | `parent` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | the widget where the search should start |
      | `name`   | `const char *`                                         |                                          |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — the found widget or NULL if not found.
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_tree_walk" file="core/lv_obj_tree.h" line="305" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L305">
      lv_obj_tree_walk [#lv_obj_tree_walk]

      Iterate through all children of any object.

      ```c title=" " lineNumbers=1
      void lv_obj_tree_walk(lv_obj_t *start_obj, lv_obj_tree_walk_cb_t cb, void *user_data)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name        | Type                                             | Description                                               |
      | ----------- | ------------------------------------------------ | --------------------------------------------------------- |
      | `start_obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | start integrating from this object                        |
      | `cb`        | <ApiLink name="lv_obj_tree_walk_cb_t" />         | call this callback on the objects                         |
      | `user_data` | `void *`                                         | pointer to any user related data (will be passed to `cb`) |
    </ApiMember>

    <ApiMember kind="function" name="lv_obj_dump_tree" file="core/lv_obj_tree.h" line="311" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L311">
      lv_obj_dump_tree [#lv_obj_dump_tree]

      Iterate through all children of any object and print their ID.

      ```c title=" " lineNumbers=1
      void lv_obj_dump_tree(lv_obj_t *start_obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name        | Type                                             | Description                        |
      | ----------- | ------------------------------------------------ | ---------------------------------- |
      | `start_obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | start integrating from this object |
    </ApiMember>
  </ApiTab>
</ApiTabs>

Enums [#enums]

<ApiMember kind="enum" name="lv_obj_tree_walk_res_t" file="core/lv_obj_tree.h" line="28" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L28">
  lv_obj_tree_walk_res_t [#lv_obj_tree_walk_res_t]

  | Name                             |
  | -------------------------------- |
  | `LV_OBJ_TREE_WALK_NEXT`          |
  | `LV_OBJ_TREE_WALK_SKIP_CHILDREN` |
  | `LV_OBJ_TREE_WALK_END`           |
</ApiMember>

Typedefs [#typedefs]

<ApiMember kind="typedef" name="lv_obj_tree_walk_cb_t" file="core/lv_obj_tree.h" line="34" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/core/lv_obj_tree.h#L34">
  lv_obj_tree_walk_cb_t [#lv_obj_tree_walk_cb_t]

  ```c title=" " lineNumbers=1
  typedef lv_obj_tree_walk_res_t(* lv_obj_tree_walk_cb_t) (lv_obj_t *, void *)
  ```
</ApiMember>

<TypeUsedBy name="lv_obj_tree_walk_cb_t" count="1">
  * `lv_obj_tree_walk` — param `cb`
</TypeUsedBy>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_types.h&#x22;, &#x22;lv_anim.h&#x22;, &#x22;lv_display.h&#x22;]" includedBy="[&#x22;lv_obj.h&#x22;]" transitiveIncludes="[&#x22;lv_area.h&#x22;, &#x22;lv_array.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_conf_internal.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;, &#x22;lv_event.h&#x22;, &#x22;lv_ext_data.h&#x22;, &#x22;lv_ll.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_string.h&#x22;, &#x22;lv_tick.h&#x22;, &#x22;lv_timer.h&#x22;]" />
