From 13c96e1504f90523613f16fce88e40251f9f32df Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 13 Jan 2023 09:28:23 +0100 Subject: [PATCH] Update layer.md --- docs/overview/layer.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/overview/layer.md b/docs/overview/layer.md index 8cb4645b5..c772bb8df 100644 --- a/docs/overview/layer.md +++ b/docs/overview/layer.md @@ -34,15 +34,14 @@ lv_label_set_text(label2, "Button 2"); /*Set the text of the label*/ lv_obj_del(label2); ``` -## Bring to the foreground +## Change order There are four explicit ways to bring an object to the foreground: - Use `lv_obj_move_foreground(obj)` to bring an object to the foreground. Similarly, use `lv_obj_move_background(obj)` to move it to the background. -- Use `lv_obj_move_up(obj)` to move an object one position up in the hierarchy, Similarly, use `lv_obj_move_down(obj)` to move an object one position down in the hierarchy. +- Use `lv_obj_move_to_index(obj, idx)` to move an object to a given index in the order of children. (0: background, child_num - 1: foreground, <0: count from the top, to move forward (up): `lv_obj_move_to_index(obj, lv_obj_get_index(obj) - 1)`) - Use `lv_obj_swap(obj1, obj2)` to swap the relative layer position of two objects. - When `lv_obj_set_parent(obj, new_parent)` is used, `obj` will be on the foreground of the `new_parent`. - ## Top and sys layers LVGL uses two special layers named `layer_top` and `layer_sys`.