Skip to main content
FCola.1
Associate II
Jun 27, 2024 1:45 PM UTC
Solved

FlexButtonCallbackHandler called after a flexButton is touched

Hello everyone, 

I am using TouchGFX 4.23.1 on STM32H750xx and I am experiencing this behaviour.  I have a screen with multilple flexbuttons and each one of them has a callback setted when it is pressed. Everything works fine except I've noticed that the callback is called only after I release the button. So after reading TouchGFX's guidelines, I have tried the handleClickEvent method but then button's flexButtonCallbackHandler is not called. So those are the two methods:

 

1) void MyScreen::flexButtonCallbackHandler(const touchgfx::AbstractButtonContainer &flexButton) -> It works fine but it is called only after I release the button; 

2)  void MyScreen::flexButtonCallbackHandler(const touchgfx::AbstractButtonContainer &flexButton) + void MyScreen::handleClickEvent(const ClickEvent& evt) -> My application can sense immediately the touch in handleClickEvent but then flexButtonCallbackHandler is not called. So I am able to differentiate PRESSED or RELEASE but I am not able to understand which button is pressed. 

 

In conclusion, I would like to have a method that could immediately call my callbacks after user's touch press (Differentiating the buttons callbacks)

This topic has been closed for replies.
JTP1Best answer
Graduate II
Jun 28, 2024 5:09 AM UTC

Hello

Please check this thread 

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/how-do-i-trigger-a-new-virtual-function-when-a-touch-button/td-p/52581

In the solution there is example how to compare the button addresses to regonize which button is pressed.

Hope this this helps you.

Br JTP

4 replies

JTP1Best answer
Graduate II
Jun 28, 2024 5:09 AM UTC

Hello

Please check this thread 

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/how-do-i-trigger-a-new-virtual-function-when-a-touch-button/td-p/52581

In the solution there is example how to compare the button addresses to regonize which button is pressed.

Hope this this helps you.

Br JTP

FCola.1
FCola.1Author
Associate II
Jun 30, 2024 12:15 PM UTC

Thank you, it's what i am looking for. 

 

jumman_JHINGA
Senior III
Jun 28, 2024 6:01 AM UTC

yes call back fuction will get trigger when youll release the button. but if you want to perfom some operation whenevr button is getting pressed then you should use this FlexButton.getPressed() in the void ScreenView::handleTickEvent() 

ST Employee
Jun 28, 2024 11:37 AM UTC

Hello @jumman_JHINGA ,

I think you are looking for functionality that allows a task to continue as long as the button is pressed. In that case, your solution of checking the state of the flex button in handleTickEvent() is correct, because callbacks are triggered only once when an event occurs.

 

Mohammad MORADIST Software Developer | TouchGFX