# lv_bar.h (/api/widgets/bar/lv_bar_h)



<RelatedHeaders name="lv_bar_private.h" isPrivate="false" />

<ApiSummary functions="16" enums="3" variables="1" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (7)&#x22;,&#x22;Getters (6)&#x22;,&#x22;Other (3)&#x22;]">
  <ApiTab value="Setters (7)">
    <ApiMember kind="function" name="lv_bar_set_value" file="widgets/bar/lv_bar.h" line="79" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L79">
      lv_bar_set_value [#lv_bar_set_value]

      Set a new value on the bar

      ```c title=" " lineNumbers=1
      void lv_bar_set_value(lv_obj_t *obj, int32_t value, lv_anim_enable_t anim)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                             | Description                                                                                |
      | ------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------ |
      | `obj`   | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a bar object                                                                    |
      | `value` | <ApiLink name="int32_t" />                       | new value                                                                                  |
      | `anim`  | <ApiLink name="lv_anim_enable_t" />              | LV\_ANIM\_ON: set the value with an animation; LV\_ANIM\_OFF: change the value immediately |
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_set_start_value" file="widgets/bar/lv_bar.h" line="87" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L87">
      lv_bar_set_start_value [#lv_bar_set_start_value]

      Set a new start value on the bar

      ```c title=" " lineNumbers=1
      void lv_bar_set_start_value(lv_obj_t *obj, int32_t start_value, lv_anim_enable_t anim)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name          | Type                                             | Description                                                                                |
      | ------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------ |
      | `obj`         | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a bar object                                                                    |
      | `start_value` | <ApiLink name="int32_t" />                       | new start value                                                                            |
      | `anim`        | <ApiLink name="lv_anim_enable_t" />              | LV\_ANIM\_ON: set the value with an animation; LV\_ANIM\_OFF: change the value immediately |
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_set_range" file="widgets/bar/lv_bar.h" line="96" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L96">
      lv_bar_set_range [#lv_bar_set_range]

      Set minimum and the maximum values of a bar

      ```c title=" " lineNumbers=1
      void lv_bar_set_range(lv_obj_t *obj, int32_t min, int32_t max)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description               |
      | ----- | ------------------------------------------------ | ------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to the bar object |
      | `min` | <ApiLink name="int32_t" />                       | minimum value             |
      | `max` | <ApiLink name="int32_t" />                       | maximum value             |

      <Callout type="info">
        If min is greater than max, the drawing direction becomes to the opposite direction.
      </Callout>
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_set_min_value" file="widgets/bar/lv_bar.h" line="103" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L103">
      lv_bar_set_min_value [#lv_bar_set_min_value]

      Set minimum value of a bar

      ```c title=" " lineNumbers=1
      void lv_bar_set_min_value(lv_obj_t *obj, int32_t min)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description               |
      | ----- | ------------------------------------------------ | ------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to the bar object |
      | `min` | <ApiLink name="int32_t" />                       | minimum value             |
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_set_max_value" file="widgets/bar/lv_bar.h" line="110" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L110">
      lv_bar_set_max_value [#lv_bar_set_max_value]

      Set maximum value of a bar

      ```c title=" " lineNumbers=1
      void lv_bar_set_max_value(lv_obj_t *obj, int32_t max)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description               |
      | ----- | ------------------------------------------------ | ------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to the bar object |
      | `max` | <ApiLink name="int32_t" />                       | maximum value             |
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_set_mode" file="widgets/bar/lv_bar.h" line="117" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L117">
      lv_bar_set_mode [#lv_bar_set_mode]

      Set the type of bar.

      ```c title=" " lineNumbers=1
      void lv_bar_set_mode(lv_obj_t *obj, lv_bar_mode_t mode)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                                             | Description                   |
      | ------ | ------------------------------------------------ | ----------------------------- |
      | `obj`  | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to bar object         |
      | `mode` | <ApiLink name="lv_bar_mode_t" />                 | bar type from `lv_bar_mode_t` |
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_set_orientation" file="widgets/bar/lv_bar.h" line="124" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L124">
      lv_bar_set_orientation [#lv_bar_set_orientation]

      Set the orientation of bar.

      ```c title=" " lineNumbers=1
      void lv_bar_set_orientation(lv_obj_t *obj, lv_bar_orientation_t orientation)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name          | Type                                             | Description                                 |
      | ------------- | ------------------------------------------------ | ------------------------------------------- |
      | `obj`         | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to bar object                       |
      | `orientation` | <ApiLink name="lv_bar_orientation_t" />          | bar orientation from `lv_bar_orientation_t` |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Getters (6)">
    <ApiMember kind="function" name="lv_bar_get_value" file="widgets/bar/lv_bar.h" line="135" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L135">
      lv_bar_get_value [#lv_bar_get_value]

      Get the value of a bar

      ```c title=" " lineNumbers=1
      int32_t lv_bar_get_value(const lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description             |
      | ----- | ------------------------------------------------------ | ----------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to a bar object |

      **Returns:** <ApiLink name="int32_t" /> — the value of the bar
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_get_start_value" file="widgets/bar/lv_bar.h" line="142" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L142">
      lv_bar_get_start_value [#lv_bar_get_start_value]

      Get the start value of a bar

      ```c title=" " lineNumbers=1
      int32_t lv_bar_get_start_value(const lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description             |
      | ----- | ------------------------------------------------------ | ----------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to a bar object |

      **Returns:** <ApiLink name="int32_t" /> — the start value of the bar
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_get_min_value" file="widgets/bar/lv_bar.h" line="149" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L149">
      lv_bar_get_min_value [#lv_bar_get_min_value]

      Get the minimum value of a bar

      ```c title=" " lineNumbers=1
      int32_t lv_bar_get_min_value(const lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description             |
      | ----- | ------------------------------------------------------ | ----------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to a bar object |

      **Returns:** <ApiLink name="int32_t" /> — the minimum value of the bar
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_get_max_value" file="widgets/bar/lv_bar.h" line="156" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L156">
      lv_bar_get_max_value [#lv_bar_get_max_value]

      Get the maximum value of a bar

      ```c title=" " lineNumbers=1
      int32_t lv_bar_get_max_value(const lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                                   | Description             |
      | ----- | ------------------------------------------------------ | ----------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="const lv_obj_t *" /> | pointer to a bar object |

      **Returns:** <ApiLink name="int32_t" /> — the maximum value of the bar
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_get_mode" file="widgets/bar/lv_bar.h" line="163" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L163">
      lv_bar_get_mode [#lv_bar_get_mode]

      Get the type of bar.

      ```c title=" " lineNumbers=1
      lv_bar_mode_t lv_bar_get_mode(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description           |
      | ----- | ------------------------------------------------ | --------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to bar object |

      **Returns:** <ApiLink name="lv_bar_mode_t" /> — bar type from `lv_bar_mode_t`
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_get_orientation" file="widgets/bar/lv_bar.h" line="170" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L170">
      lv_bar_get_orientation [#lv_bar_get_orientation]

      Get the orientation of bar.

      ```c title=" " lineNumbers=1
      lv_bar_orientation_t lv_bar_get_orientation(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description           |
      | ----- | ------------------------------------------------ | --------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to bar object |

      **Returns:** <ApiLink name="lv_bar_orientation_t" /> — bar orientation from `lv_bar_orientation_t`
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (3)">
    <ApiMember kind="function" name="lv_bar_create" file="widgets/bar/lv_bar.h" line="67" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L67">
      lv_bar_create [#lv_bar_create]

      Create a bar object

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_bar_create(lv_obj_t *parent)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name     | Type                                             | Description                                                |
      | -------- | ------------------------------------------------ | ---------------------------------------------------------- |
      | `parent` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to an object, it will be the parent of the new bar |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to the created bar
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_is_symmetrical" file="widgets/bar/lv_bar.h" line="177" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L177">
      lv_bar_is_symmetrical [#lv_bar_is_symmetrical]

      Give the bar is in symmetrical mode or not

      ```c title=" " lineNumbers=1
      bool lv_bar_is_symmetrical(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description           |
      | ----- | ------------------------------------------------ | --------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to bar object |

      **Returns:** <ApiLink name="bool" /> — true: in symmetrical mode false : not in
    </ApiMember>

    <ApiMember kind="function" name="lv_bar_bind_value" file="widgets/bar/lv_bar.h" line="186" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L186">
      lv_bar_bind_value [#lv_bar_bind_value]

      Bind an integer or float Subject to a Bar's value.

      ```c title=" " lineNumbers=1
      lv_observer_t * lv_bar_bind_value(lv_obj_t *obj, lv_subject_t *subject)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name      | Type                                                     | Description        |
      | --------- | -------------------------------------------------------- | ------------------ |
      | `obj`     | <ApiLink name="lv_obj_t" display="lv_obj_t *" />         | pointer to Bar     |
      | `subject` | <ApiLink name="lv_subject_t" display="lv_subject_t *" /> | pointer to Subject |

      **Returns:** <ApiLink name="lv_observer_t" display="lv_observer_t *" /> — pointer to newly-created Observer
    </ApiMember>
  </ApiTab>
</ApiTabs>

Enums [#enums]

<ApiMember kind="enum" name="lv_bar_mode_t" file="widgets/bar/lv_bar.h" line="32" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L32">
  lv_bar_mode_t [#lv_bar_mode_t]

  | Name                      |
  | ------------------------- |
  | `LV_BAR_MODE_NORMAL`      |
  | `LV_BAR_MODE_SYMMETRICAL` |
  | `LV_BAR_MODE_RANGE`       |
</ApiMember>

<TypeUsedBy name="lv_bar_mode_t" count="1">
  * `lv_bar_set_mode` — param `mode`
</TypeUsedBy>

<ApiMember kind="enum" name="lv_bar_orientation_t" file="widgets/bar/lv_bar.h" line="38" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L38">
  lv_bar_orientation_t [#lv_bar_orientation_t]

  | Name                            |
  | ------------------------------- |
  | `LV_BAR_ORIENTATION_AUTO`       |
  | `LV_BAR_ORIENTATION_HORIZONTAL` |
  | `LV_BAR_ORIENTATION_VERTICAL`   |
</ApiMember>

<TypeUsedBy name="lv_bar_orientation_t" count="1">
  * `lv_bar_set_orientation` — param `orientation`
</TypeUsedBy>

<ApiMember kind="enum" name="_lv_property_bar_id_t" file="widgets/bar/lv_bar.h" line="47" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L47">
  \_lv_property_bar_id_t [#_lv_property_bar_id_t]

  | Name                          | Value                                                        |
  | ----------------------------- | ------------------------------------------------------------ |
  | `LV_PROPERTY_BAR_VALUE`       | `(LV_PROPERTY_BAR_START + ((int) 0 )) \| ((  1   ) <<  28 )` |
  | `LV_PROPERTY_BAR_START_VALUE` | `(LV_PROPERTY_BAR_START + ((int) 1 )) \| ((  1   ) <<  28 )` |
  | `LV_PROPERTY_BAR_MIN_VALUE`   | `(LV_PROPERTY_BAR_START + ((int) 2 )) \| ((  1   ) <<  28 )` |
  | `LV_PROPERTY_BAR_MAX_VALUE`   | `(LV_PROPERTY_BAR_START + ((int) 3 )) \| ((  1   ) <<  28 )` |
  | `LV_PROPERTY_BAR_MODE`        | `(LV_PROPERTY_BAR_START + ((int) 4 )) \| ((  1   ) <<  28 )` |
  | `LV_PROPERTY_BAR_ORIENTATION` | `(LV_PROPERTY_BAR_START + ((int) 5 )) \| ((  1   ) <<  28 )` |
  | `LV_PROPERTY_BAR_END`         |                                                              |
</ApiMember>

Variables [#variables]

<ApiMember kind="variable" name="lv_bar_class" file="widgets/bar/lv_bar.h" line="44" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/bar/lv_bar.h#L44">
  lv_bar_class [#lv_bar_class]

  ```c title=" " lineNumbers=1
  const lv_obj_class_t lv_bar_class
  ```
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;, &#x22;lv_obj.h&#x22;, &#x22;lv_anim.h&#x22;, &#x22;lv_label.h&#x22;, &#x22;lv_observer.h&#x22;]" includedBy="[&#x22;lv_bar_private.h&#x22;, &#x22;lv_slider.h&#x22;]" transitiveIncludes="[&#x22;lv_area.h&#x22;, &#x22;lv_array.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_bidi.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;, &#x22;lv_display.h&#x22;, &#x22;lv_draw.h&#x22;, &#x22;lv_draw_arc.h&#x22;, &#x22;lv_draw_blur.h&#x22;, &#x22;lv_draw_buf.h&#x22;, &#x22;lv_draw_image.h&#x22;, &#x22;lv_draw_label.h&#x22;, &#x22;lv_draw_line.h&#x22;, &#x22;lv_draw_rect.h&#x22;, &#x22;lv_draw_triangle.h&#x22;, &#x22;lv_event.h&#x22;, &#x22;lv_ext_data.h&#x22;, &#x22;lv_flex.h&#x22;, &#x22;lv_font.h&#x22;, &#x22;lv_fs.h&#x22;, &#x22;lv_grad.h&#x22;, &#x22;lv_grid.h&#x22;, &#x22;lv_group.h&#x22;, &#x22;lv_image_decoder.h&#x22;, &#x22;lv_image_dsc.h&#x22;, &#x22;lv_indev.h&#x22;, &#x22;lv_layout.h&#x22;, &#x22;lv_ll.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_matrix.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_obj_class.h&#x22;, &#x22;lv_obj_draw.h&#x22;, &#x22;lv_obj_event.h&#x22;, &#x22;lv_obj_pos.h&#x22;, &#x22;lv_obj_property.h&#x22;, &#x22;lv_obj_property_names.h&#x22;, &#x22;lv_obj_scroll.h&#x22;, &#x22;lv_obj_style.h&#x22;, &#x22;lv_obj_style_gen.h&#x22;, &#x22;lv_obj_tree.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_profiler.h&#x22;, &#x22;lv_profiler_builtin.h&#x22;, &#x22;lv_sprintf.h&#x22;, &#x22;lv_string.h&#x22;, &#x22;lv_style.h&#x22;, &#x22;lv_style_gen.h&#x22;, &#x22;lv_style_properties.h&#x22;, &#x22;lv_symbol_def.h&#x22;, &#x22;lv_text.h&#x22;, &#x22;lv_tick.h&#x22;, &#x22;lv_timer.h&#x22;, &#x22;lv_types.h&#x22;]" />
