Skip to content

Commit c696926

Browse files
committed
Keep button visible, but disabled
1 parent b393105 commit c696926

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/displayapp/screens/StopWatch.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,12 @@ StopWatch::StopWatch(DisplayApp* app)
8484
lv_obj_set_height(btnStopLap, 50);
8585
lv_obj_set_width(btnStopLap, 115);
8686
lv_obj_align(btnStopLap, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
87+
lv_obj_set_style_local_bg_color(btnStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x080808));
8788
txtStopLap = lv_label_create(btnStopLap, nullptr);
88-
lv_obj_set_hidden(btnStopLap, true);
89+
lv_obj_set_style_local_text_color(txtStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x888888));
90+
lv_label_set_text(txtStopLap, Symbols::stop);
91+
lv_obj_set_state(btnStopLap, LV_STATE_DISABLED);
92+
lv_obj_set_state(txtStopLap, LV_STATE_DISABLED);
8993

9094
lapOneText = lv_label_create(lv_scr_act(), nullptr);
9195
// 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() {
132136
lapNr = 0;
133137

134138
if (currentEvent == Events::Play) {
135-
lv_obj_set_hidden(btnStopLap, false);
139+
lv_obj_set_state(btnStopLap, LV_STATE_DEFAULT);
140+
lv_obj_set_state(txtStopLap, LV_STATE_DEFAULT);
136141

137142
startTime = xTaskGetTickCount();
138143
currentState = States::Running;
139144
} else {
140-
lv_obj_set_hidden(btnStopLap, true);
145+
lv_obj_set_state(btnStopLap, LV_STATE_DISABLED);
146+
lv_obj_set_state(txtStopLap, LV_STATE_DISABLED);
141147
}
142148
break;
143149
}

0 commit comments

Comments
 (0)