Skip to main content
JLakn
Associate III
May 20, 2020
Solved

Posible bug in Touchgfx Keyboard ?

  • May 20, 2020
  • 4 replies
  • 1983 views

Hey, 

I'm working on custom board Touchgfx project and I'm using Keyboard widget for text input. During testing I found out that keyboard Cancel event is not working properly.

Description of problem: 

When i click and hold on one of keys and drag out of this area the keyboard cancels event and nothing happens as expected. But when i click again on any other or same key and release it in area of this key nothing happens again ( here i would expect that belonging character is written in text buffer). Keyboard starts working normal after second press and release. 

 I tried it also in Keyboard Example in touchgfx UI templates. Example works the same as I described. For better understanding I'm atthacing video.

I have already managed to solve these problems by editing the Keyboard.cpp file, but I still report this to clarify whether this is an bug or my misunderstanding of using Keyboard.

This topic has been closed for replies.
Best answer by Soren Pingel DALSGAARD

Hi again,

Thanks for your feedback and I was probably a bit quick to write the bug off as a bad use of the simulator. Sorry about that. I was able to reproduce it, and I have made a fix which should make it into the next release of TouchGFX.

The bug is in Keyboard.cpp in

if (key.keyId != 0)
{

located at line 201. Both lines should be moved to JUST ABOVE line 220:

if (buffer)
{

so the code looks like:

...
 Keyboard::Key key = getKeyForCoordinates(x, y);
 if (type == ClickEvent::PRESSED)
 {
 <same code>;
 }
 if (type == ClickEvent::RELEASED)
 {
 if (cancelIsEmitted)
 {
 cancelIsEmitted = false;
 }
 else
 {
 if (key.keyId != 0)
 {
 if (buffer)
 {
 Unicode::UnicodeChar c = getCharForKey(key.keyId);
...

I hope this helps.

4 replies

Alexandre RENOUX
Visitor II
May 22, 2020

Hello,

Thank you very much for your remark, we will try to fix this issue as soon as possible.

/Alexandre

Soren Pingel DALSGAARD
Visitor II
November 17, 2020

Hi,

I looked into this, and it is not an actual bug in TouchGFX. I noticed that you move the mouse completely outside the simulator window, so TouchGFX never gets the button release event. The second time you click on the key (or actually anywhere inside the simulator window) the mouse down is discarded and the mouse up is handled. Since you already dragged away from the "J", the event is cancelled. In other words, the second press is just the completion of the first drag (outside the simulator).

If you click the "J" and drag to another key (still inside the simulator window) everything works as expected.

I hope this clarifies the issue. If not, please let us know.

Regards,

Søren

JLakn
JLaknAuthor
Associate III
November 17, 2020

Hi @Soren Pingel DALSGAARD​ ,

I watched the video again and I can't see that I moved the mouse completely outside the simulator window ( I moved it outside the keyboard area). So I tried again and record another video so you can clearly see what I mean:

First case:

  • first I click on key J and move out of keyboard area and release the mouse (as you can see here i definitely didn't move outside the simulator window)
  • than i click on J again and nothing happens ( I would expect here that the J will be seen in text input box)
  • only when i click the second time on J the letter is seen in input box

Second case:

  • second I tried to click on J and move mouse from key J and released it but not outside the keyboard area
  • when I click on J again the letter is written in input box as it should be in the first case

I suggest you try it yourself and if possible try it on a hardware not simulator . I noticed this problem on real hardware with a touch display . I still think that this is a bug as I can't see the right purpose of this.

Soren Pingel DALSGAARD
Visitor II
November 18, 2020

Hi again,

Thanks for your feedback and I was probably a bit quick to write the bug off as a bad use of the simulator. Sorry about that. I was able to reproduce it, and I have made a fix which should make it into the next release of TouchGFX.

The bug is in Keyboard.cpp in

if (key.keyId != 0)
{

located at line 201. Both lines should be moved to JUST ABOVE line 220:

if (buffer)
{

so the code looks like:

...
 Keyboard::Key key = getKeyForCoordinates(x, y);
 if (type == ClickEvent::PRESSED)
 {
 <same code>;
 }
 if (type == ClickEvent::RELEASED)
 {
 if (cancelIsEmitted)
 {
 cancelIsEmitted = false;
 }
 else
 {
 if (key.keyId != 0)
 {
 if (buffer)
 {
 Unicode::UnicodeChar c = getCharForKey(key.keyId);
...

I hope this helps.

JLakn
JLaknAuthor
Associate III
November 19, 2020

Hi @Soren Pingel DALSGAARD​ 

Today I tried the fix and it works.

Thank you .