Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added lv_obj_move_to_index(obj, index), renamed lv_obj_get_child_id(obj) to lv_obj_get_index(obj) #2514

Merged
merged 13 commits into from Sep 5, 2021

Conversation

Karijn
Copy link
Contributor

@Karijn Karijn commented Aug 31, 2021

  • added lv_obj_move_to_index(obj, index).
  • renamed lv_obj_get_child_id(obj) to lv_obj_get_index(obj).

Description of the feature or fix

A clear and concise description of what the bug or new feature is.

Checkpoints

@Karijn
Copy link
Contributor Author

Karijn commented Aug 31, 2021

Hi, the inline function did give an error during the MP Build, other options i tried did not work either.

* @return the child index of the object.
* E.g. 0: the oldest (firstly created child)
*/
uint32_t lv_obj_get_child_id(const struct _lv_obj_t * obj);
uint32_t lv_obj_get_child_id(const struct _lv_obj_t* obj);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making it static inline in this header instead of lv_api_map.h should work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that did work, thanks

src/lv_api_map.h Outdated Show resolved Hide resolved
src/core/lv_obj_tree.c Outdated Show resolved Hide resolved
src/core/lv_obj_tree.h Show resolved Hide resolved
@kisvegabor
Copy link
Member

Thanks you, I had a few comments.

@Karijn
Copy link
Contributor Author

Karijn commented Sep 1, 2021

i think i solved all comments (or did i miss one)?

@kisvegabor
Copy link
Member

Thanks you, only one question remained for me:
I think lv_obj_move_background/foregrund should be only static inline wrappers to lv_obj_move_to_index().

What do you think?

@Karijn
Copy link
Contributor Author

Karijn commented Sep 2, 2021

Thanks you, only one question remained for me:
I think lv_obj_move_background/foregrund should be only static inline wrappers to lv_obj_move_to_index().

What do you think?

No reason nof to, i think. I will create the inlines tonight.

… as inline functions now calling lv_obj_move_to_index(obj, index).

- lv_obj_swap(obj1, obj2) added. (lvgl#2461)
@Karijn
Copy link
Contributor Author

Karijn commented Sep 2, 2021

redefined lv_obj_move_foreground(obj) and lv_obj_move_background(obj) as inline functions now calling lv_obj_move_to_index(obj, index).

@kisvegabor I have only one concern with this change: will these functions still be picked up by MicroPython?

@kisvegabor
Copy link
Member

I have only one concern with this change: will these functions still be picked up by MicroPython?

Yes, the function in lv_api_map.h can be seen in MicroPython.


All looks good to me. I'm very happy with the result. Now we have only a simple but very flexible function for child order manipulation.

Thank you very much!

@kisvegabor kisvegabor merged commit 780e0ef into lvgl:master Sep 5, 2021
@Karijn
Copy link
Contributor Author

Karijn commented Sep 8, 2021

Hi,

I see that the new functions are in the latest lv_micropython version. But how can i enable them in micropython (I don't find them in the lv_mpy_example.c file)

@amirgon
Copy link
Contributor

amirgon commented Sep 8, 2021

@Karijn I can see you updated the C examples.
Are you planning to update the corresponding Micropython examples?

@Karijn
Copy link
Contributor Author

Karijn commented Sep 9, 2021

@amirgon, yes definitely. As soon as i have the new and changed functions working in MP, I'll do a PR for the samples and documentation for MicroPython. (actually, i needed those functions in MP in the first place :-))

@amirgon
Copy link
Contributor

amirgon commented Sep 9, 2021

As soon as i have the new and changed functions working in MP

They are working for me on MP.
Any specific problem I can help you with?

@Karijn
Copy link
Contributor Author

Karijn commented Sep 9, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants