cancel
Showing results for 
Search instead for 
Did you mean: 

Scroll wheel using hardware buttons

KM L.1
Associate II

Hi,

I'm working on stm32h7 controller and also designed GUI using scroll wheel and able to scroll using touch but i need to scroll the wheel up and down using two hardware buttons.

I also created the queue in model but how to scroll up and down.

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

ScrollWheelBase.hpp supports the following function:

void ScrollWheelBase::animateToPosition(int32_t position, int16_t steps)

/Martin

View solution in original post

6 REPLIES 6
Martin KJELDSEN
Chief III

ScrollWheelBase.hpp supports the following function:

void ScrollWheelBase::animateToPosition(int32_t position, int16_t steps)

/Martin

Martin KJELDSEN
Chief III

​And you could play around with "steps" to make it go faster or slower depending on how manically you press some button :)

Alirezaganjeh
Associate II

Greetings dear friends,

I'm also encountering this issue. I've created a scroll list with 10 items and I want to navigate between these items using a hardware button. Could you please guide me on which command I can use to achieve this? I would greatly appreciate your assistance.

Please guide me on this post.

Greetings my friend and welcome to the TouchGFX community!

 

Martin is long gone and wont answer you so let me do it for him.

 

There is 2 things you want to do here :
 - getting the button click event to TouchGFX
 - scrolling the scrollList with code

 

To understand how to get a hardware button click to the TouchGFX engine, please look at the 3 videos below:
 - ControllersTech : Send data to UI || Sampling from the GUI task 
 - ControllersTech : Send data to UI || Sampling from another task 
 - STM32 Graphics: Using “Hardware button is clicked” at Interactions 

 

Now, to scroll the list through code, you can look at the API documentation:  api/classes/classtouchgfx_1_1_scroll_list 

I think, the best method to use is "animateToItem".
It allows you to jump to an item, so when pressing your button, you will increment or decrement an index referring to the item number you want to focus on and the scrollList will smoothly scroll to the next (or previous) item.
This has the advantage of scrolling the perfect amount instead of setting manually a number of pixels to scroll.
To use it, you should keep a variable and check that it doesn't go below 0 nor does it go over getNumberOfItems().

 

I cannot provide you with an example because I don't know what hardware you use.
If you have related questions, feel free to ask!

 

This post is quite old, next time, you will have more luck by creating a new thread.

 

Regards,

thanks for your guide