LVGL change text on existing label with Platform IO

What do you want to achieve?

What have you tried so far?

Code to reproduce

No working code

Screenshot and/or video

Environment

  • MCU/MPU/Board:
    ESP32 Dev board
  • LVGL version: See lv_version.h
    9.1
    I am using EEZ studio to generate code for my pages. I have created LVGL events to trigger C++ code to do xyz. While xyz is running I need to change the button’s label from “SCAN” to “SCANNING” and when xyz is complete change the text to “SCAN FINISHED”. How do I get a hook to the label object to perform these actions. The lv_Get_object_by_name does not exist. What is a work around?

Hi @kbrussow! Have you tried using Observer/Subject feature of LVGL?

You can look at documentation here: How to Use - LVGL 9.4 documentation

You could do for example lv_label_bind_text(label, &subject, format_string);

And whenever that subject changes the label text will change automatically.

That’s the great thing about LVGL Observer/Subject feature. You can have reactive and decoupled UIs from the main application.

Check here also: LVGL's Subject-Observer pattern for UI data binding | LVGL posted on the topic | LinkedIn

Please post back here if you have any other questions. We will be glad to help.