studio icon indicating copy to clipboard operation
studio copied to clipboard

[LVGL] add action Increment and Decrement value Spinbox

Open elmonic opened this issue 1 year ago • 9 comments

The spinbox widget has the ability to increase and decrease the value with the selection of a number in action LVGL. If possible, it should be added to the software.

void lv_spinbox_increment(lv_obj_t *obj) void lv_spinbox_decrement(lv_obj_t *obj)

Untitled2

Similar to the image below: Untitled

elmonic avatar Aug 18 '24 12:08 elmonic

Check the Spinbox example:

image

Here, the spinbox value increment and decrement is implemented by simply changing the value variable.

mvladic avatar Aug 18 '24 12:08 mvladic

thanks I saw the example that you posted, but this method is not practical and has limitations, that is when the number of widgets of the spinbox increases and this process must be done for each one. This feature of increasing and decreasing, shifting and the selected digit is placed inside the LVGL itself and is compatible with the mouse and touch as well as with the keyboard keys of this feature (such as up, down, and enter).

Untitled3

I did this process by coding, but it is much better if it is done with the software itself and it increases the speed and efficiency of the design. Untitled4

elmonic avatar Aug 18 '24 13:08 elmonic

I don't understand the argument that when the number of Spinbox's increases the meted presented in Spinbox example is not practical.

mvladic avatar Aug 18 '24 13:08 mvladic

When you are working on a large project and you have, for example, 20 spinbox widgets, for each of which, according to your example, we have to put 6 flow actions and we have to create a total of 120 actions inside the page, do you think it makes sense?! When LVGL itself supports this process, why do we start the path again and this process occupies more RAM. All these conditions are new without taking into account the limitations of choosing and moving the character that I wrote to you before.

Look at the page below. Now, if I want to do your process for 10 spinbox widgets, do you think it is reasonable with this number of actions? Untitled5

elmonic avatar Aug 19 '24 05:08 elmonic

Like the video below, very easy and fast😊 https://github.com/user-attachments/assets/d74c899c-3988-45c1-992d-729e3cfa8e52

elmonic avatar Aug 19 '24 06:08 elmonic

Ok, I can add these two actions in the future as you recommended.

While tinkering about this issue I again tested the Spinbox example from EEZ Studio. In my example, when Spinbox step is changed with the touch interface then step variable in the flow is not properly updated (this is the case you showed in your video). But, if you change the step with the encoder everything works as it should. I reported this difference in behavior in LVGL repository, see https://github.com/lvgl/lvgl/issues/6702.

When you are working on a large project and you have, for example, 20 spinbox widgets, for each of which, according to your example, we have to put 6 flow actions and we have to create a total of 120 actions inside the page, do you think it makes sense?!

Actually, only two flow actions are required:

image

Here is how it works:

spinbox_step_change2

But, we need to wait for LVGL to fix https://github.com/lvgl/lvgl/issues/6702. While testing I fixed this bug by myself.

mvladic avatar Aug 19 '24 11:08 mvladic

Still, to be fair, my solution requires another variable for the step. If we have action for Spinbox Increment and Decrement then we wouldn't need this variable.

mvladic avatar Aug 19 '24 11:08 mvladic

I understand there is a bug in LVGL but should this work within EEZ Studio testing? I've tried the spinbox example but clicking in the spin box does not update the step variable. The highlighted number reverts to the right digit and step remains at a value of 1. Windows version 0.15.1

ttump avatar Aug 20 '24 08:08 ttump

It is precisely because of this bug that it does not work in Studio.

mvladic avatar Aug 20 '24 10:08 mvladic