Skip to main content
Ajudi.1
Associate
April 3, 2021
Question

Can I Simulate a TouchGFX button click with ClickEvent? How?

  • April 3, 2021
  • 2 replies
  • 1627 views

I am trying to "press" a button without actually touching the touchscreen of my development board.

Reading the TouchGFX documentation, I found that there is a method called

ClickEvent, that seems like it might do the trick.

I tried calling the following:

// ClickEvent(ClickEventType type, int16_t x, int16_t y, int16_t force =0)
ClickEvent(ClickEvent::PRESSED,396,420);

The X and Y coordinates were obtained from TouchGFX Designer, as you can see in the following image.

0693W000008ydmQQAQ.pngEven though it compiles, I can't seem to get this to work.

I am not sure if I am using this the correct way, or maybe there is another way generating a click.

PD: I am using TouchGFX version 4.13

Thanks

This topic has been closed for replies.

2 replies

Alexandre RENOUX
Visitor II
April 6, 2021

Hello Ajudi.1,

ClickEvent is linked to your touchscreen so it's not the right way to do in my opinion.

What do you mean by  trying to "press" a button without actually touching the touchscreen ? Are you trying to use hardware buttons ?

/Alexandre

ADow.1
Associate II
November 3, 2021

Hi Ajudi.1,

I'm not sure if you're still having that problem, but something like this may help:

ClickEvent ev = ClickEvent(ClickEvent::RELEASED,396,420);

flexButton1.setPressed(true);

flexButton1.handleClickEvent(ev);

or you can have the first 'click' be of type PRESSED and another 'click' to be "RELEASED"

/Abeer