From 5c6a7fa6d32ea490644aae3b6d30b1352997b7d9 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 4 Mar 2020 11:09:10 +0100 Subject: [PATCH] btn: fix lv_btn_set_state to remove DIABLED state if other state is set --- src/lv_widgets/lv_btn.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lv_widgets/lv_btn.c b/src/lv_widgets/lv_btn.c index da66f5fcd..26f913c3f 100644 --- a/src/lv_widgets/lv_btn.c +++ b/src/lv_widgets/lv_btn.c @@ -134,20 +134,21 @@ void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state) switch(state) { case LV_BTN_STATE_RELEASED: - lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED); + lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED); break; case LV_BTN_STATE_PRESSED: - lv_obj_clear_state(btn, LV_STATE_CHECKED); + lv_obj_clear_state(btn, LV_STATE_CHECKED | LV_STATE_DISABLED); lv_obj_add_state(btn, LV_STATE_PRESSED); break; case LV_BTN_STATE_CHECKED_RELEASED: lv_obj_add_state(btn, LV_STATE_CHECKED); - lv_obj_clear_state(btn, LV_STATE_PRESSED); + lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_DISABLED); break; case LV_BTN_STATE_CHECKED_PRESSED: - lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED); + lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED); break; case LV_BTN_STATE_DISABLED: + lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED); lv_obj_add_state(btn, LV_STATE_DISABLED); break; }