zankezaa escreveu: 13 Nov 2025, 00:46
After i make this watchface there known issue is when on altimeter and barometer the world time is not showing, but if on compass section the world time is showing. Is there any error in my script?
Here i attached my projects.
Explanation
The code above will always hide normal_time_gmt_text from the start (hmUI.prop.VISIBLE, false).
Then, in the click_CONTENT() function you used to change element_index,
you call it again for each value (1–4):
normal_time_gmt_text.setProperty(hmUI.prop.VISIBLE, element_index == 2);
normal_time_gmt_text.setProperty(hmUI.prop.VISIBLE, element_index == 3);
normal_time_gmt_text.setProperty(hmUI.prop.VISIBLE, element_index == 4);
This means:
If element_index == 2 → the first line will be set to true,
but the second and third lines will be set to false again (because 2 ≠ 3 and 2 ≠ 4).
The final result is that VISIBLE becomes false again.
That is, the "true value" is overwritten by the "false value" from the following lines.

Summary of results
Element_index value, working line, final result
1 (no visible set for text)

Not displayed
2 True then false then false

Not displayed
3 False then true then false

Not displayed
4 False then false then true

Displayed
I think you don't understand the logic, which is why you're getting an unintended logic error. If I were to suggest using
.setProperty(hmUI.prop.VISIBLE, false);
.setProperty(hmUI.prop.VISIBLE, true);
to implement the function, it will help you understand it better.
If you want to use logic ( true false ), here's how to fix it:

Solution
Leave only one line to control. normal_time_gmt_text
By adjusting in click_CONTENT() like this:
Código: Selecionar todos
function click_CONTENT() {
element_index++;
if (element_index > element_count) element_index = 1;
normal_digital_clock_img_time.setProperty(hmUI.prop.VISIBLE, element_index == 1);
normal_digital_clock_hour_separator_img.setProperty(hmUI.prop.VISIBLE, element_index == 1);
normal_step_current_text_font.setProperty(hmUI.prop.VISIBLE, element_index == 1);
normal_heart_rate_text_font.setProperty(hmUI.prop.VISIBLE, element_index == 1);
normal_altitude_target_text_img.setProperty(hmUI.prop.VISIBLE, element_index == 2);
normal_altitude_target_separator_img.setProperty(hmUI.prop.VISIBLE, element_index == 2);
normal_altimeter_text_text_img.setProperty(hmUI.prop.VISIBLE, element_index == 3);
normal_altimeter_text_separator_img.setProperty(hmUI.prop.VISIBLE, element_index == 3);
normal_compass_text_img.setProperty(hmUI.prop.VISIBLE, element_index == 4);
normal_compass_separator_img.setProperty(hmUI.prop.VISIBLE, element_index == 4);
// Make it show all pages (2, 3, 4)
normal_time_gmt_text.setProperty(
hmUI.prop.VISIBLE,
element_index == 2 || element_index == 3 || element_index == 4
);
if (element_index == 1) hmUI.showToast({ text: 'DIGITAL TIME' });
if (element_index == 2) hmUI.showToast({ text: 'ALTIMETER' });
if (element_index == 3) hmUI.showToast({ text: 'BAROMETER' });
if (element_index == 4) hmUI.showToast({ text: 'COMPASS' });
}