Skip to main content
DCost.1
Associate II
Feb 18, 2020 10:23 AM UTC
Question

How to show the text written with a keyboard in the TextArea?

Hi,

I have implemented a keyboard on TouchGFX and it works properly (the example keyboard).

My objective is to make that the typed text with the keyboard appears in the textArea that i have selected. I tried it using the Wildcard text but it doesn't worked for me.

Thanks,

Dani.

This topic has been closed for replies.

5 replies

Martin KJELDSEN
Principal III
Feb 18, 2020 11:02 AM UTC

Hi Dani,

It's a bit unclear to me what you're trying to do. Can you rephrase?

/Martin

DCost.1
DCost.1Author
Associate II
Feb 18, 2020 11:15 AM UTC

Hi Martin,

It's a common application, when we use the keyboard in our mobiles, we can see what we are writting in the corresponding text area; in this way i would like to do something like that.

I am using the code of the keyboard that provides the designer.

The following code is from CustomKeyboard.cpp:

#include <gui/common/CustomKeyboard.hpp>

CustomKeyboard::CustomKeyboard() : keyboard(),

  modeBtnTextArea(),

  capslockPressed(this, &CustomKeyboard::capslockPressedHandler),

  backspacePressed(this, &CustomKeyboard::backspacePressedHandler),

  modePressed(this, &CustomKeyboard::modePressedHandler),

  keyPressed(this, &CustomKeyboard::keyPressedhandler),

  alphaKeys(true),

  uppercaseKeys(false),

  firstCharacterEntry(false)

{

  //Set the callbacks for the callback areas of the keyboard and set its layout.

  layout.callbackAreaArray[0].callback = &capslockPressed;

  layout.callbackAreaArray[1].callback = &backspacePressed;

  layout.callbackAreaArray[2].callback = &modePressed;

  keyboard.setLayout(&layout);

  keyboard.setKeyListener(keyPressed);

  keyboard.setPosition(0, 0, 320, 240);

  keyboard.setTextIndentation();

  //Allocate the buffer associated with keyboard.

  memset(buffer, 0, sizeof(buffer));

  keyboard.setBuffer(buffer, BUFFER_SIZE);

  uppercaseKeys = true;

  firstCharacterEntry = true;

  modeBtnTextArea.setPosition(5, 196, 56, 40);

  modeBtnTextArea.setColor(Color::getColorFrom24BitRGB(0xFF, 0xFF, 0xFF));

  setKeyMappingList();

  add(keyboard);

  add(modeBtnTextArea);

}

....

I would like to know how are the typed letters saved in the keyboard buffer, in order to copy it's content and show it simultaneously through a textArea.

I tried this code in the MainView.cpp:

...

void MainView::setupScreen()

{

Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%d", buffer);

textArea1.invalidate();

}

....

Thanks,

Dani

DCost.1
DCost.1Author
Associate II
Feb 18, 2020 12:04 PM UTC

Now i'm trying with:

...

void MainView::setupScreen()

{

memcpy(T_SINGLEUSEID1, T_ENTEREDTEXT, 18);

Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%d", T_SINGLEUSEID1);

textArea1.invalidate(); 

}

...

Where T_SINGLEUSEID1 is the content of the textArea1 and T_ENTEREDTEXT is the typed text with the keyboard (i think so at least).

It still doesn't work.

Martin KJELDSEN
Principal III
Feb 18, 2020 12:35 PM UTC

But doesn't the example do exactly this? It shows you what you're typing - in the textarea.

/Martin

DCost.1
DCost.1Author
Associate II
Feb 19, 2020 7:19 AM UTC

Yes, but i would like to show it in a different textarea every time.

Dani