2020-04-29 09:44 PM
I want to use scroll list or scroll wheel functionality using external triggers ( hardware buttons ). Like if I press up key highlighted selection in scroll list will go up and if I press down key selection will go down. And after pressing enter button it should go in respective screen.
How can I leverage scroll list or wheel APIs for this purpose?
I am using latest version of CubeMX and TouchGFX Generator.
If any example code is available then it will really help me a lot.
2020-04-29 11:20 PM
Hi @ChintanParmar ,
From what I understand, you have a graphic display with a separate keypad & you intend to use TouchGFX framework & that you have to scroll a list of items, using a set of keys, say UP & DOWN.
You could try the following ( I have not done anything like this, this is just based on my understanding of the TouchGFX framework ) :
1) Create a task that scans the keypad matrix. This task, on detection of a valid keypress, can call a function in the Model class & this function can then inform the presenter about the key press. The presenter can then :
a) call the animateToItem(...) function of the ScrollList object. Refer : https://support.touchgfx.com/docs/api/classes/classtouchgfx_1_1_scroll_base#function-animatetoitem
OR
b) You can also try to emulate a drag event & send the notification of the event to the current view, using the handleDragEvent function.
Refer : https://support.touchgfx.com/docs/api/classes/classtouchgfx_1_1_application#function-handledragevent
You might have to set certain attributes of the ScrollList object using one of the the above mentioned api functions.
1) + b) seems to be a better way to me.
/Jagdish
2020-05-01 05:50 AM
Hi @Jagdish Bisawa ,
Thanks for your reply.
I have tried it with inbuilt Button Controller function. Nicely explained in External events as triggers post.
In that, we have to define which key is pressed and according to that have to pass some values in key variable.
And that value will be compared in HandleKeyEvent() function and accordingly action is taken?
Are you telling same thing in 1) option?
( You have elaborated very nicely but I am very new to C++. So don't understand the terms like model class and presenter. )
If that is correctly implemented then should you tell me that where should I called handleDragEvent function? ( I think in handleKeyEvent function, am I right? )
If possible, Can you give some simple example?
Your help will be appreciated.
Chintan.
2020-05-01 06:54 AM
Hi @ChintanParmar ,
Please ignore option b) mentioned in my previous post - this is for dragging a widget, which is not required in our case.
1) + a) should work, but you have to be familiar with the C++ programming language to work around TouchGFX, since it is a C++ based framework.
The Model class, along with the View & presenter class form the basis of a way for managing UI application. This is called the MVP model. Get familiar with this by studying on the internet & the TouchGFX documentation.
If time permits I will try to implement what you want, on my hardware & share the details.
Meanwhile, what hardware are you using ?
/Jagdish
2020-05-01 07:08 AM
Hi Jagdish,
I am using STM32F429 Discovery kit for evaluation purpose.
If any simple example on any platform can help me.
In TouchGFX Documentation they have given example that how external events as triggers can handled.
But If I want to use other functionalities ( like scrolling list ) with hardware buttons then what to do?
Thanks for your help.
2020-05-03 11:00 PM
Hi @ChintanParmar ,
The animatetoitem function in the ScrollList should help you achieve what you want. I tried something & was able to do that, though the scrolling was not the way I wanted. This means some more settings in the ScrollList object is required or the ScrollList needs to be understood better by reading the api.
I found something similar to what you want :
https://community.st.com/s/question/0D50X0000B09SiC/visible-items-in-scrolllist
Hope the above helps.
/Jagdish