From 9faca8a8d4125e21dedbf6e46aa1586a6b57e5b8 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 13 Jan 2023 09:27:22 +0100 Subject: [PATCH] Update layer.md --- docs/overview/layer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/overview/layer.md b/docs/overview/layer.md index 8cb4645b5..dd4301b3a 100644 --- a/docs/overview/layer.md +++ b/docs/overview/layer.md @@ -34,11 +34,11 @@ 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: backgroud, 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`.