Skip to main content
Epamuk
Associate III
August 23, 2021
Question

Software trigger for keypressed handler (keyboard example)

  • August 23, 2021
  • 4 replies
  • 1466 views

Hi, I need keyboard for my project. But I dont have touchscreen. I added touchgfx keyboard sample codes to my code. But It needs keypressedHandler.

Which I want to do is to trigger this keyPressedHandler callback from my code.

For example when I get a keycode from uart I want to trigger this callback (like a touchscreen event ocurred)

Anyone has a solution or example code for this purpose ?

Thanks

Erdem

This topic has been closed for replies.

4 replies

Xzhiy.1
Associate II
August 23, 2021

You can make ClickEvent by yourself, many demo have that example code, for example, almost all TouchGFx demo can do auto demo when there is no user tough on screen for some seconds, this is what you need, this sort of code spread in presenter or view class, for example :

presenter.oneSecond();

view.screenClick(ClickEvent::PRESSED, 650, 220);

study demos, you find more.  following funciton from Game2048.

void Game2048View::screenClick(ClickEvent::ClickEventType type, int x, int y)

{

  ClickEvent temp_evt(type, x, y);

  View::handleClickEvent(temp_evt);

}

I hope this is some hint can help some, I just leaning TouchGfx for one week, not know much.

Epamuk
EpamukAuthor
Associate III
August 23, 2021

Hi,

I cant find "Game2048View::screenClick" function in code. Which touchgfx version are you using? I use 4.16.1

Epamuk
EpamukAuthor
Associate III
August 24, 2021

OK, I did it. Thanks

Walid ZRELLI
Visitor II
August 24, 2021

Hello @Epamuk​ ,

You can take a look at the following demonstration provided under our H7 Firmware Package ( Path: Projects\STM32H7B3I-EVAL\Demonstrations\ClockAndWeather)

It might help you.

BeST Regards,

Walid