Bar widget does not export Range mode in code

Sorry, my English is not very good, I try to make it understood as best as possible.

I don’t know if it is a bug or this is the correct way to activate range mode in the bar widget

What do you want to achieve?

use the bar widget in range mode, when exporting the code the range mode is not activated

What have you tried so far?

Later in my code I activate the range mode of the bar widget with lv_bar_set_mode() and then I can use lv_bar_set_start_value() normally

Screenshot or video

SquareLine Project:

Export Code:

ui_RedLineBar = lv_bar_create(ui_MainScreen);
lv_obj_set_width( ui_RedLineBar, 310);
lv_obj_set_height( ui_RedLineBar, 30);
lv_obj_set_x( ui_RedLineBar, 62 );
lv_obj_set_y( ui_RedLineBar, -190 );
lv_obj_set_align( ui_RedLineBar, LV_ALIGN_CENTER );
lv_obj_set_style_radius(ui_RedLineBar, 0, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_RedLineBar, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT );
lv_obj_set_style_bg_opa(ui_RedLineBar, 0, LV_PART_MAIN| LV_STATE_DEFAULT);

lv_obj_set_style_radius(ui_RedLineBar, 0, LV_PART_INDICATOR| LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_RedLineBar, lv_color_hex(0xFF0303), LV_PART_INDICATOR | LV_STATE_DEFAULT );
lv_obj_set_style_bg_opa(ui_RedLineBar, 255, LV_PART_INDICATOR| LV_STATE_DEFAULT);
lv_obj_set_style_blend_mode(ui_RedLineBar, LV_BLEND_MODE_MULTIPLY, LV_PART_INDICATOR| LV_STATE_DEFAULT);

My solution for now:

// Set the range mode and map the redline value to the bar length
    lv_bar_set_mode(ui_RedLineBar, LV_BAR_MODE_RANGE);
    lv_bar_set_start_value(ui_RedLineBar, map(_rpmsRedline, 5000, 10000, 0, 100), LV_ANIM_OFF);


  • **SquareLine Studio version: 1.3.2
  • **Operating system: Windows 11
  • **Target hardware: ESP32S3 Arduino Framework
1 Like

I have the same bug in v1.3.3, I tried to use a bar in symmetrical mode but it is not set in the generated code.

Thanks for the feedback. Indeed, I can confirm this in SLS-v1.3.3. It doesn’t help if the start-value is set to nonzero either. We’ll fix this issue soon.