2021-02-08 06:18 AM
I am using normal buttons and I set an interaction like thisI saw this function will be called when button is released in this link -> https://community.st.com/s/question/0D50X0000BKAnAV/is-there-a-way-to-have-button-trigger-on-the-press-of-the-button-and-not-the-release
and I want to have event when it is pressed. I went AbstractButton.cpp for this and I did some changes but I couldn't see any effect. I added printf but couldn't see anything on the screen, I commented out functions but it is still firing callback.
Here is the callbackIn this callback I tried to use getPressedState() function to see if released or pressed but TouchGFX IDE always deletes what I write.
Can you help me to solve this problem?
2021-02-08 08:32 AM
I have a similar problem and I partially solved it, so (perhaps) can be useful my post :
and :
2021-02-09 12:46 AM
I modified ClickButtonTrigger.hpp to see something but TouchGFX doesn't compile that file. I also tried to have compiling errors with wrong parenthesis in AbstractButton.cpp but I couldn't get from there too. I could see those errors when I modified AbstractButton.hpp so only this file compiled for AbstractButton.
2021-02-09 09:14 AM
I'm not a TouchGFX expert so I'm not sure I can help you...
I noticed you have a buttonCallbackHandler(..), so I think you are using a "normal" button. ClickButtonTrigger seems (in my opinion) to be used by flexButtonCallbackHandler, so you have to use a flexbutton.
Surely, my solution isn't the best one, as you have to re-modify the ScreenViewBase.cpp every time you modify the TouchGFX layout, but this is the life!
2021-02-09 11:30 PM
Yes my buttons are normal buttons. I could get what I want but I still have questions. TouchGFX creates this in AbstractButton.hpp
and below function in AbstractButton.cpp but it doesn't compile that file.
And I was knowing its compiling AbstractButton.hpp so I put that function in AbstractButton.hpp also added some code to fire callback when button pressed.It is firing my callback when button is both pressed and released. Now I have some flags to store button statuses. And I can change data to run and stop motors. TouchGFX doesn't delete this codes so I dont have to modify it every time.
As I said before I changed location of handleClickEvent AbstractButton.cpp to AbstractButton.hpp. And I saw its working in this location. I commented out this functionsand as expected I saw none of the buttons were working. How buttons were working before location change if it needs this function? And isn't there better way to get pressed event?