mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
feat(object_tree): make lv_obj_get_index return error value if the object has no parent (#4152)
This commit is contained in:
parent
312303cb44
commit
78645a5967
@ -339,7 +339,7 @@ uint32_t lv_obj_get_index(const lv_obj_t * obj)
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
if(parent == NULL) return 0;
|
||||
if(parent == NULL) return 0xFFFFFFFF;
|
||||
|
||||
uint32_t i = 0;
|
||||
for(i = 0; i < lv_obj_get_child_cnt(parent); i++) {
|
||||
|
@ -151,7 +151,8 @@ uint32_t lv_obj_get_child_cnt(const struct _lv_obj_t * obj);
|
||||
* Get the index of a child.
|
||||
* @param obj pointer to an object
|
||||
* @return the child index of the object.
|
||||
* E.g. 0: the oldest (firstly created child)
|
||||
* E.g. 0: the oldest (firstly created child).
|
||||
* (0xFFFFFFFF if child could not be found or no parent exists)
|
||||
*/
|
||||
uint32_t lv_obj_get_index(const struct _lv_obj_t * obj);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user