From 27154b632c0f62e6a9f8ea7039b51fcf28592959 Mon Sep 17 00:00:00 2001 From: minyiky <71966069+minyiky@users.noreply.github.com> Date: Sun, 31 Jan 2021 16:40:57 +0000 Subject: [PATCH] feat(spinbox) add get_step function (#2051) Adds a static inline function to allow access to the step parameter for the spinbox widget --- CHANGELOG.md | 3 ++- src/lv_widgets/lv_spinbox.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd84682d1..35a6d0d0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ ## v7.9.2 (Planned for 02.02.2021) ### New features -- feat(indev) allow input events to be passed to disabled objects +- feat(indev) allow input events to be passed to disabled objects +- feat(spinbox) add inline get_step function for MicroPython support ### Bugfixes - fix(btnmatrix) fix lv_btnmatrix_get_active_btn_text() when used in a group diff --git a/src/lv_widgets/lv_spinbox.h b/src/lv_widgets/lv_spinbox.h index 93c665d27..f6747888b 100644 --- a/src/lv_widgets/lv_spinbox.h +++ b/src/lv_widgets/lv_spinbox.h @@ -135,6 +135,18 @@ bool lv_spinbox_get_rollover(lv_obj_t * spinbox); */ int32_t lv_spinbox_get_value(lv_obj_t * spinbox); +/** + * Get the spinbox step value (user has to convert to float according to its digit format) + * @param spinbox pointer to spinbox + * @return value integer step value of the spinbox + */ +static inline int32_t lv_spinbox_get_step(lv_obj_t * spinbox) +{ + lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox); + + return ext->step; +} + /*===================== * Other functions *====================*/