diff options
| author | Riku Isokoski <riksu9000@gmail.com> | 2021-05-26 13:13:40 (GMT) |
|---|---|---|
| committer | Riku Isokoski <riksu9000@gmail.com> | 2021-05-26 13:13:40 (GMT) |
| commit | c6969268fc162c41dbb37f7a2f061858563ba3c1 (patch) | |
| tree | e1c4da1088cc61013f68118f33bae3ce94cd0f22 | |
| parent | b39310508292b6d5f0d235872fad6b0bf31efb75 (diff) | |
Keep button visible, but disabled
| -rw-r--r-- | src/displayapp/screens/StopWatch.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index 76c4bfa..7c128d1 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -84,8 +84,12 @@ StopWatch::StopWatch(DisplayApp* app) lv_obj_set_height(btnStopLap, 50); lv_obj_set_width(btnStopLap, 115); lv_obj_align(btnStopLap, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); + lv_obj_set_style_local_bg_color(btnStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x080808)); txtStopLap = lv_label_create(btnStopLap, nullptr); - lv_obj_set_hidden(btnStopLap, true); + lv_obj_set_style_local_text_color(txtStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x888888)); + lv_label_set_text(txtStopLap, Symbols::stop); + lv_obj_set_state(btnStopLap, LV_STATE_DISABLED); + lv_obj_set_state(txtStopLap, LV_STATE_DISABLED); lapOneText = lv_label_create(lv_scr_act(), nullptr); // lv_obj_set_style_local_text_font(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); @@ -132,12 +136,14 @@ bool StopWatch::Refresh() { lapNr = 0; if (currentEvent == Events::Play) { - lv_obj_set_hidden(btnStopLap, false); + lv_obj_set_state(btnStopLap, LV_STATE_DEFAULT); + lv_obj_set_state(txtStopLap, LV_STATE_DEFAULT); startTime = xTaskGetTickCount(); currentState = States::Running; } else { - lv_obj_set_hidden(btnStopLap, true); + lv_obj_set_state(btnStopLap, LV_STATE_DISABLED); + lv_obj_set_state(txtStopLap, LV_STATE_DISABLED); } break; } |
