cancel
Showing results for 
Search instead for 
Did you mean: 

long touch detect on STM32L4R9AI-eval

prathima
Associate II

hello...

I am working on STM32L4R9AI-EVAL board..i want to detect the long touch..means in one screen if i do long touch it has to go to the other screen...I need deep explanation

how do i do this ....any example code

thank you

14 REPLIES 14

It was not done using the Designer, it's a class completely written by the programmer. Therefore, you will not see it in the Designer but only when you run the application. Every custom widget you create will not be displayed in the Designer.

customButtonContainer is an arbitrary name you can call it whatever you want.

/Alexandre

This a new file you have added into project ...or you have modified any existing file....

please mention where your doing it....and what is the result so that i can modify according to my application...

Thank you..

The customButtonContainer .hpp file is a completely added file. It is not generated by TouchGFX Designer.

It is added to [your project directory]/gui/include/gui/common/

/Alexandre

Thank you so much Alexandre RENOUX .....Glad it's working fine

RGajd.1
Associate II

Hi @prathima​ 

You can also detect long touch in handleTickEvent if You use flexButton with Touch trigger.

Then You can detect how long is pressed the button.

Pseudocode:

bool btTouched;  
uint32_t timeTouched;  // variable for long touch time measurment
 
void buttonClicked() {  // virtual function declared in TouchGFX designer
   btTouched = true;
   timeTouched = 0;
}
 
void screenView::handleTickEvent() {
   if(myFlexButton.getPressed()) timeTouched += 16; // every tick has around 16ms
   if(timeTouched>500 && btTouched)  {
     btTouched = false;   // avoid retriggering
     // do anything when 500ms elapsed
   }

Regards,

R. Gajda

}