cancel
Showing results for 
Search instead for 
Did you mean: 

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

DCost.1
Associate II

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.

5 REPLIES 5
Martin KJELDSEN
Chief III

Hi Dani,

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

/Martin

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
Associate II

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
Chief III

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

/Martin

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

Dani