From b9224c1acedf911353156cf926848b90d8f165ae Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Thu, 11 Aug 2022 11:16:57 +0300 Subject: Disable value_str value_str is a way to add text on a button without a separate label. This saves having an extra label object, but uses more memory and is removed in LVGL8 --- src/displayapp/screens/settings/SettingSetDate.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/displayapp/screens/settings/SettingSetDate.cpp') diff --git a/src/displayapp/screens/settings/SettingSetDate.cpp b/src/displayapp/screens/settings/SettingSetDate.cpp index 1407a98f..421aef02 100644 --- a/src/displayapp/screens/settings/SettingSetDate.cpp +++ b/src/displayapp/screens/settings/SettingSetDate.cpp @@ -79,9 +79,11 @@ SettingSetDate::SettingSetDate(Pinetime::Applications::DisplayApp* app, Pinetime lv_obj_set_size(btnSetTime, 120, 48); lv_obj_align(btnSetTime, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_obj_set_style_local_bg_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x38, 0x38, 0x38)); - lv_obj_set_style_local_value_str(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Set"); + lblSetTime = lv_label_create(btnSetTime, nullptr); + lv_label_set_text_static(lblSetTime, "Set"); lv_obj_set_event_cb(btnSetTime, event_handler); lv_btn_set_state(btnSetTime, LV_BTN_STATE_DISABLED); + lv_obj_set_state(lblSetTime, LV_STATE_DISABLED); } SettingSetDate::~SettingSetDate() { @@ -102,10 +104,12 @@ void SettingSetDate::HandleButtonPress() { dateTimeController.Seconds(), nrf_rtc_counter_get(portNRF_RTC_REG)); lv_btn_set_state(btnSetTime, LV_BTN_STATE_DISABLED); + lv_obj_set_state(lblSetTime, LV_STATE_DISABLED); } void SettingSetDate::CheckDay() { const int maxDay = MaximumDayOfMonth(monthCounter.GetValue(), yearCounter.GetValue()); dayCounter.SetMax(maxDay); lv_btn_set_state(btnSetTime, LV_BTN_STATE_RELEASED); + lv_obj_set_state(lblSetTime, LV_STATE_DEFAULT); } -- cgit v1.2.3-70-g09d2