The page I exported using the "gui guide" code will turn white after adding group, and the page cannot be loaded. It is added in "setup_scr_screen";
lv_group_t *group = lv_group_create();
lv_group_add_obj(group, ui->BootPage_btn_1);
lv_group_add_obj(group, ui->BootPage_btn_2);
lv_indev_set_group(keypadIndevice, group);
Hi @qqt_996
Here’s a checklist and potential solutions:
Checklist:
1. Ensure Proper Initialization: Make sure that keypadIndevice is properly initialized before it is used with lv_indev_set_group().
2. Group Creation and Association: Verify that lv_group_create() is called before any objects are added to the group using lv_group_add_obj(). Ensure that the objects (ui->BootPage_btn_1, ui->BootPage_btn_2) are valid and already initialized.
3. Input Device Setup: Confirm that the keypadIndevice is correctly set up with lv_indev_set_group(). The device should be initialized to capture inputs (e.g., keypad or encoder) and be correctly assigned to the group.
4. Check Memory Issues: If the screen turns white, it might be due to memory corruption or overflow. Ensure that there is sufficient memory allocated for objects, groups, and other GUI elements.
5. Debugging LVGL Events: Enable LVGL logging (LV_USE_LOG) to capture logs that might provide insights into what’s happening when the screen turns white.
6. Screen Re-draw: Make sure that the screen is properly redrawn after the group is created and objects are added. Sometimes forcing a redraw can help resolve the display issue.
BR
Hang
lv_group_t* group= lv_group_create();
lv_group_add_obj(group, ui->Parameters_list_1_item0);
lv_group_add_obj(group, ui->Parameters_list_1_item1);
lv_indev_set_group(keypadIndevice, group);
lv_group_focus_obj(ui->Parameters_list_1_item0);
Setting focus through lv_group_focus_obj, the control successfully sets focus, but the style does not change。
Hi @qqt_996
Here are a few things to check:
1. Ensure Styles are Defined for Focused State: Make sure you have defined a style that should be applied when the object is focused. Typically, you need to set styles for the LV_STATE_FOCUSED state on the object. For example:
lv_obj_t * obj = lv_obj_create(parent);
lv_style_t style_focused;
lv_style_init(&style_focused);
lv_style_set_bg_color(&style_focused, lv_color_hex(0xFF0000)); // Example: red background when focused
lv_obj_add_style(obj, &style_focused, LV_STATE_FOCUSED);
2. Check Group Focus Callbacks: Ensure that your object’s styles are being properly updated when the object is focused. LVGL might have a callback mechanism that needs to be properly set up to update the style when the focus changes.
lv_group_set_focus_cb(group, focus_cb);
void focus_cb(lv_group_t * group)
{
lv_obj_t * focused_obj = lv_group_get_focused(group);
// Update style or handle the focused state here
}
3. Ensure the UI Theme Does Not Override Styles: If you’re using a theme, it might be overriding your style settings.
BR
Hang