cancel
Showing results for 
Search instead for 
Did you mean: 

FlexButtonCallbackHandler called after a flexButton is touched

FCola.1
Associate II

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)

3 REPLIES 3
JTP1
Lead

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

JJhin.1
Senior

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() 

Hello @JJhin.1 ,

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 MORADI
ST Software Developer | TouchGFX