2022-12-13 06:14 PM
I am having trouble with the ClickListener. I am trying to debounce the click event somehow. My first instinct is to delay and then check to see if the click is still present, but I am not sure it will work with this function because it seems that the click is an event that is triggered. For example, here is one of my click hander calls:
void MainView::circleClickHandler(const touchgfx::Circle& c, const ClickEvent& evt)
{
Any suggestions on what the proper way to debounce a ClickListener object is? The buttons that are built-in widgets seem to do this with no additional code. Thanks in advance!
P.S. - programming with the STM32F469I-DISCO board.
Solved! Go to Solution.
2022-12-14 07:33 PM
OK, so I figured out how to make this work:
void MainView::circleClickHandler(const touchgfx::Circle& c, const ClickEvent& evt)
{
if(evt.getType() == touchgfx::ClickEvent::PRESSED){
if (&c == &headCircle)
{..}
}
Thanks for the tip to use the click event type!
2022-12-14 02:59 AM
Hello Kneepatch,
I'm not sure to have understood what do you mean by "debounce" the click event. Can you clarify this?
Do you want to get the click status?
/Osman
2022-12-14 04:16 AM
Yes, I think that click status might do the trick! Whenever I pressed a button, it would seem to "unclick" itself, and I think that's because it was triggering whenever I RELEASED. I'll try it and come back if that doesn't work, thanks!
2022-12-14 04:24 AM
Having trouble getting the compiler to recognize my syntax here, trying to get the ClickEventType from the ClickEvent parameter:
void MainView::circleClickHandler(const touchgfx::Circle& c, const ClickEvent& evt)
{
if(evt.getEventType() == ClickEventType::PRESSED){
I get the error:
MainView.cpp:35:27: error: 'ClickEventType' has not been declared
2022-12-14 07:33 PM
OK, so I figured out how to make this work:
void MainView::circleClickHandler(const touchgfx::Circle& c, const ClickEvent& evt)
{
if(evt.getType() == touchgfx::ClickEvent::PRESSED){
if (&c == &headCircle)
{..}
}
Thanks for the tip to use the click event type!
2022-12-16 05:31 AM
You're welcome!
2022-12-16 05:32 AM
Great to hear you succeed ;)
/Osman