feat(obj) add lv_obj_swap() function (#2461)

* proposal for lv_obj_swap() function

* review issues applied

* review changes for comments
This commit is contained in:
Karijn Wessing
2021-08-18 11:32:10 +02:00
committed by GitHub
parent 36ddbd0756
commit 9a1f7f2fcb
8 changed files with 153 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
# Changelog
## v8.1.0 (In progress)
- lv_obj_swap(obj1, obj2) added. (#2461)
- feat(anim) add interface for handling lv_anim user data. (#2415)
- feat(obj) add lv_is_initialized (#2402)
- feat(obj) Backport keypad and encoder scrolling from v7 `lv_page` to v8 `lv_obj` (#2390)

View File

@@ -40,8 +40,9 @@ lv_obj_del(label2);
## Bring to the foreground
There are 2 explicit way to bring an object to the foreground:
There are 3 explicit way to bring an object to the foreground:
- Use `lv_obj_move_foreground(obj)` to explicitly tell the library to bring an object to the foreground. Similarly, use `lv_obj_move_background(obj)` to move to the background.
- Use `lv_obj_swap(obj1, obj2)` to swap the relative position of two objects.
- When `lv_obj_set_parent(obj, new_parent)` is used, `obj` will be on the foreground on the `new_parent`.
## Top and sys layers

View File

@@ -69,6 +69,8 @@ for(i = 0; i < lv_obj_get_child_cnt(parent); i++) {
You can bring an object to the foreground or send it to the background with `lv_obj_move_foreground(obj)` and `lv_obj_move_background(obj)`.
You can swap the position of two objects with `lv_obj_swap(obj1, obj2)`.
### Screens
When you have created a screen like `lv_obj_t * screen = lv_obj_create(NULL)`, you can load it with `lv_scr_load(screen)`. The `lv_scr_act()` function gives you a pointer to the current screen.