Pagina 1 di 1

Dynamically changing font color

Inviato: 26 ago 2024, 21:29
da toolsrme
Does anyone know a way to dynamically change a font color for a hmUI.widget.TEXT or hmUI.widget.TEXT_FONT object through something like a touch of the screen.

I've been able to do it hmUI.widget.TEXT if it the type value isn't set. So I was able to do it with code like this:

Codice: Seleziona tutto

            temp_text = hmUI.createWidget(hmUI.widget.TEXT, {
              x: 184,
              y: 158,
              w: 202,
              h: 50,
              text_size: 40,
              char_space: 0,
              line_space: 0,
              color: 0xFF24AAE2,
              align_h: hmUI.align.LEFT,
              align_v: hmUI.align.TOP,
              show_level: hmUI.show_level.ONLY_NORMAL,
            });
But not with code like this:

Codice: Seleziona tutto

            temp_text = hmUI.createWidget(hmUI.widget.TEXT, {
              x: 184,
              y: 158,
              w: 202,
              h: 50,
              text_size: 40,
              char_space: 0,
              line_space: 0,
              color: 0xFF24AAE2,
              align_h: hmUI.align.LEFT,
              align_v: hmUI.align.TOP,
              type: hmUI.data_type.WEATHER_CURRENT,
              show_level: hmUI.show_level.ONLY_NORMAL,
            });
Somehow adding in the "type" property I lose control over stuff like the color.

The problem is that I haven't been able to access all the sensor data to get information all all the stuff I want to change the color of. Current temp, altimeter, altitude, uvi, calorie, pai, wind, step, heart, etc...

While I have the javascript that changes the color property for the text object, it just never updates the display.