lv_obj_scroll.h
API reference for lv_obj_scroll.h
Functions
lv_obj_set_scrollbar_mode
Set how the scrollbars should behave.
void lv_obj_set_scrollbar_mode(lv_obj_t *obj, lv_scrollbar_mode_t mode)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
mode | lv_scrollbar_mode_t | LV_SCROLL_MODE_ON/OFF/AUTO/ACTIVE |
lv_obj_set_scroll_dir
Set direction Widget can be scrolled
void lv_obj_set_scroll_dir(lv_obj_t *obj, lv_dir_t dir)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
dir | lv_dir_t | one or more bit-wise OR-ed values of lv_dir_t enumeration |
lv_obj_set_scroll_snap_x
Set where to snap the children when scrolling ends horizontally
void lv_obj_set_scroll_snap_x(lv_obj_t *obj, lv_scroll_snap_t align)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
align | lv_scroll_snap_t | value from lv_scroll_snap_t enumeration |
lv_obj_set_scroll_snap_y
Set where to snap the children when scrolling ends vertically
void lv_obj_set_scroll_snap_y(lv_obj_t *obj, lv_scroll_snap_t align)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
align | lv_scroll_snap_t | value from lv_scroll_snap_t enumeration |
lv_obj_get_scrollbar_mode
Get the current scroll mode (when to hide the scrollbars)
lv_scrollbar_mode_t lv_obj_get_scrollbar_mode(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to Widget |
Returns: lv_scrollbar_mode_t — the current scroll mode from lv_scrollbar_mode_t
lv_obj_get_scroll_dir
Get directions Widget can be scrolled (set with lv_obj_set_scroll_dir())
lv_dir_t lv_obj_get_scroll_dir(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to Widget |
Returns: lv_dir_t — current scroll direction bit(s)
lv_obj_get_scroll_snap_x
Get where to snap child Widgets when horizontal scrolling ends.
lv_scroll_snap_t lv_obj_get_scroll_snap_x(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to Widget |
Returns: lv_scroll_snap_t — current snap value from lv_scroll_snap_t
lv_obj_get_scroll_snap_y
Get where to snap child Widgets when vertical scrolling ends.
lv_scroll_snap_t lv_obj_get_scroll_snap_y(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to Widget |
Returns: lv_scroll_snap_t — current snap value from lv_scroll_snap_t
lv_obj_get_scroll_x
Get current X scroll position. Identical to lv_obj_get_scroll_left().
int32_t lv_obj_get_scroll_x(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to scrollable container Widget |
Returns: int32_t — current scroll position from left edge
- If Widget is not scrolled return 0.
- If scrolled return > 0.
- If scrolled inside (elastic scroll) return < 0.
lv_obj_get_scroll_y
Get current Y scroll position. Identical to lv_obj_get_scroll_top().
int32_t lv_obj_get_scroll_y(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to scrollable container Widget |
Returns: int32_t — current scroll position from top edge
- If Widget is not scrolled return 0.
- If scrolled return > 0.
- If scrolled inside (elastic scroll) return < 0.
lv_obj_get_scroll_top
Number of pixels a scrollable container Widget can be scrolled down before its top edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag is set in Widget, this value can go negative while Widget is being dragged below its normal top-edge boundary.
int32_t lv_obj_get_scroll_top(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to scrollable container Widget |
Returns: int32_t — pixels Widget can be scrolled down before its top edge appears
lv_obj_get_scroll_bottom
Number of pixels a scrollable container Widget can be scrolled up before its bottom edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag is set in Widget, this value can go negative while Widget is being dragged above its normal bottom-edge boundary.
int32_t lv_obj_get_scroll_bottom(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to scrollable container Widget |
Returns: int32_t — pixels Widget can be scrolled up before its bottom edge appears
lv_obj_get_scroll_left
Number of pixels a scrollable container Widget can be scrolled right before its left edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag is set in Widget, this value can go negative while Widget is being dragged farther right than its normal left-edge boundary.
int32_t lv_obj_get_scroll_left(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to scrollable container Widget |
Returns: int32_t — pixels Widget can be scrolled right before its left edge appears
lv_obj_get_scroll_right
Number of pixels a scrollable container Widget can be scrolled left before its right edge appears. When LV_OBJ_FLAG_SCROLL_ELASTIC flag is set in Widget, this value can go negative while Widget is being dragged farther left than its normal right-edge boundary.
int32_t lv_obj_get_scroll_right(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to scrollable container Widget |
Returns: int32_t — pixels Widget can be scrolled left before its right edge appears
lv_obj_get_scroll_end
Get the X and Y coordinates where the scrolling will end for Widget if a scrolling animation is in progress. If no scrolling animation, give the current x or y scroll position.
void lv_obj_get_scroll_end(lv_obj_t *obj, lv_point_t *end)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to scrollable Widget |
end | lv_point_t * | pointer to lv_point_t object in which to store result |
lv_obj_get_scrollbar_area
Get the area of the scrollbars
void lv_obj_get_scrollbar_area(lv_obj_t *obj, lv_area_t *hor_area, lv_area_t *ver_area)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
hor_area | lv_area_t * | pointer to store the area of the horizontal scrollbar |
ver_area | lv_area_t * | pointer to store the area of the vertical scrollbar |
lv_obj_scroll_by
Scroll by given amount of pixels.
void lv_obj_scroll_by(lv_obj_t *obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to scrollable Widget to scroll |
dx | int32_t | pixels to scroll horizontally |
dy | int32_t | pixels to scroll vertically |
anim_en | lv_anim_enable_t | LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately |
> 0 value means scroll right/bottom (show the more content on the right/bottom)
e.g. dy = -20 means scroll down 20 px
lv_obj_scroll_by_bounded
Scroll by given amount of pixels. dx and dy will be limited internally to allow scrolling only on the content area.
void lv_obj_scroll_by_bounded(lv_obj_t *obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to scrollable Widget to scroll |
dx | int32_t | pixels to scroll horizontally |
dy | int32_t | pixels to scroll vertically |
anim_en | lv_anim_enable_t | LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately |
e.g. dy = -20 means scroll down 20 px
lv_obj_scroll_to
Scroll to given coordinate on Widget. x and y will be limited internally to allow scrolling only on the content area.
void lv_obj_scroll_to(lv_obj_t *obj, int32_t x, int32_t y, lv_anim_enable_t anim_en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to scrollable Widget to scroll |
x | int32_t | pixels to scroll horizontally |
y | int32_t | pixels to scroll vertically |
anim_en | lv_anim_enable_t | LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately |
lv_obj_scroll_to_x
Scroll to X coordinate on Widget. x will be limited internally to allow scrolling only on the content area.
void lv_obj_scroll_to_x(lv_obj_t *obj, int32_t x, lv_anim_enable_t anim_en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to scrollable Widget to scroll |
x | int32_t | pixels to scroll horizontally |
anim_en | lv_anim_enable_t | LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately |
lv_obj_scroll_to_y
Scroll to Y coordinate on Widget. y will be limited internally to allow scrolling only on the content area.
void lv_obj_scroll_to_y(lv_obj_t *obj, int32_t y, lv_anim_enable_t anim_en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to scrollable Widget to scroll |
y | int32_t | pixels to scroll vertically |
anim_en | lv_anim_enable_t | LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately |
lv_obj_scroll_to_view
Scroll obj's parent Widget until obj becomes visible.
void lv_obj_scroll_to_view(lv_obj_t *obj, lv_anim_enable_t anim_en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget to scroll into view |
anim_en | lv_anim_enable_t | LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately |
lv_obj_scroll_to_view_recursive
Scroll obj's parent Widgets recursively until obj becomes visible. Widget will be scrolled into view even it has nested scrollable parents.
void lv_obj_scroll_to_view_recursive(lv_obj_t *obj, lv_anim_enable_t anim_en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget to scroll into view |
anim_en | lv_anim_enable_t | LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately |
lv_obj_is_scrolling
Tell whether Widget is being scrolled or not at this moment
bool lv_obj_is_scrolling(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to Widget |
Returns: bool — true: obj is being scrolled
lv_obj_stop_scroll_anim
Stop scrolling the current object
void lv_obj_stop_scroll_anim(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | The object being scrolled |
lv_obj_update_snap
Check children of obj and scroll obj to fulfill scroll_snap settings.
void lv_obj_update_snap(lv_obj_t *obj, lv_anim_enable_t anim_en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | Widget whose children need to be checked and snapped |
anim_en | lv_anim_enable_t | LV_ANIM_ON/OFF |
lv_obj_scrollbar_invalidate
Invalidate the area of the scrollbars
void lv_obj_scrollbar_invalidate(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
lv_obj_readjust_scroll
Checks if the content is scrolled "in" and adjusts it to a normal position.
void lv_obj_readjust_scroll(lv_obj_t *obj, lv_anim_enable_t anim_en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
anim_en | lv_anim_enable_t | LV_ANIM_ON/OFF |
Enums
lv_scrollbar_mode_t
Scrollbar modes: shows when should the scrollbars be visible
| Name | Description |
|---|---|
LV_SCROLLBAR_MODE_OFF | Never show scrollbars |
LV_SCROLLBAR_MODE_ON | Always show scrollbars |
LV_SCROLLBAR_MODE_ACTIVE | Show scroll bars when Widget is being scrolled |
LV_SCROLLBAR_MODE_AUTO | Show scroll bars when the content is large enough to be scrolled |
Used by 1 function
lv_obj_set_scrollbar_mode— parammode
lv_scroll_snap_t
Scroll span align options. Tells where to align the snappable children when scroll stops.
| Name | Description |
|---|---|
LV_SCROLL_SNAP_NONE | Do not align, leave where it is |
LV_SCROLL_SNAP_START | Align to the left/top |
LV_SCROLL_SNAP_END | Align to the right/bottom |
LV_SCROLL_SNAP_CENTER | Align to the center |
Used by 2 functions
lv_obj_set_scroll_snap_x— paramalignlv_obj_set_scroll_snap_y— paramalign
Dependencies
Indirect dependencies
Last updated on