cancel
Showing results for 
Search instead for 
Did you mean: 

How do we know if our hand is on the button at TouchGFX?

Freedom_Neo
Senior

How do we know if our hand is on the button? e.g; If our hand is on a button, the led is always on, if we raise our hand over that button, the led turns off.

16 REPLIES 16

Hi Andrew Neil,

I did work this application. But I need a little different. I need as in the video below. It will work as long as the button is pressed, and it will not work when I take my hand off the button. For example; When my hand is pressed on the button, the led will turn on, but when I take my hand off the button, the led will turn off.

What I want to do is, as long as my hand is pressed on the button, the numbers will increase, but when I take my hand off the button, the numbers will not increase.

I've been trying to solve this problem for a few days

So you just need to watch the PRESSED and RELEASED events, and act accordingly on each.

Freedom_Neo
Senior

Hi,

I worked as below project. But this aplication works in the simulator but doesnt work at the hardware dewolopment board

What, exactly, does "doesn't work" mean?

What debugging have you done to find out what's happening?

Freedom_Neo
Senior

It works in the simulator environment, but it doesn't work properly on my board. While my hand is on the button, it has to continuously increase the number, but it does not do it.

I have attached two videos showing how it works both in the simulator and on my board. You can look there.

Freedom_Neo
Senior

Working status on my board

Osman SOYKURT
ST Employee

Hello Freedom_Neo,

In your videos, your UIs are not the same on your simulator and your board. Is t still the same application ?

Also, the question is already answered here :

https://community.st.com/s/question/0D50X0000CBl0asSQB/long-touch-detect-on-stm32l4r9aieval

and here : https://community.st.com/s/question/0D53W00001YdFteSAF/long-press-button-increment-fast-value

As Alexandre RENOUX said, you have to create a new class for your custom button because the standard Button class in TouchGFX only triggers on clicked. So in your Designer, do not use a Button widget.

There's also another solution given by RGajd.1. Have you tried this one ?

Try to investigate a bit more about how to create your own custom buttons, and let us know if you need help on doing it :)

/Osman

Osman SOYKURT
ST Software Developer | TouchGFX