Skip to main content
Associate III
March 7, 2025
Solved

TouchGFX designer, Flex button or any other option available for Long Press of Touch button

  • March 7, 2025
  • 4 replies
  • 786 views

Hello All,

 

I am new TouchGFX and working on it recently, I am trying to implement Long Press (if user touches button continuously) to increment value on Text Area, continuously until user releases flex button press.

Right now, the configuration for flex button to trigger is for Click, I can see option for Touch as well but it's not working as intended.  I can see the value update every Click but need to have value to increase as long as User Touch is Pressed.

Would appreciate, any guidance or some references to try out to do it.

 

Br,

Shiv

    This topic has been closed for replies.
    Best answer by LouisB

    Hello @ShivDesh,

    You can refer to this post Solved: Re: Repeat Button triggers immediately, bug or fea... - STMicroelectronics Community.

    BR,

    4 replies

    ShivDeshAuthor
    Associate III
    March 10, 2025

    Hello Team,

    Any suggestion or direction to try and experiment with for the flex button long press fixes?

     

    Regards,

    SD

    jumman_JHINGA
    Senior III
    March 10, 2025

    you can do it with normal buttons. you have to create one interaction that gets triggers with every N tick and executes c++ code. there you can check button state by calling this  button.getPressedState() function, you can check button is pressed or not if pressed you can  increament variable continusly. check following example:

     

    if(buttonUp.getPressedState()){
    	uint16_t CrntVal = textProgress1.getValue();
    	CrntVal++;
    	textProgress1.setValue(CrntVal);	
    }
    
    if(buttonDw.getPressedState()){
    	uint16_t CrntVal = textProgress1.getValue();
    	if(CrntVal > 0)
    		CrntVal--;
    	else
    		CrntVal =0;
    	textProgress1.setValue(CrntVal);	
    }

     

     

    ShivDeshAuthor
    Associate III
    March 17, 2025

    Hello @jumman_JHINGA 

     

    Thanks for the direction you have provided, yes after some required modifications, this concept did work as expected. Thanks again.

    LouisBBest answer
    ST Employee
    March 10, 2025
    Louis BOUDOST Software Engineer | TouchGFX