Adding button functionalities to costum keyboard TOUCHGFX
Hi, I've created a custom keyboard and so far all works good. I've just a problem: I want to use an OK button on the keyboard to copy the text edited to a text area in an other screen. I'm able to go to the other screen but when i do the second part of my goal, I've got errors. I think the problem is in the function getBuffer.
-This is the part in customkeyboard.cpp
void CustomKeyboard::okPressedHandler()
{
getBuffer(); // function to save the actual entered text
application().gotoScreen01ScreenNoTransition(); // if i use only this line the code work to change screeen
}
-Part in customkeyboard.hpp
virtual void getBuffer()
{
// implemented in screen02_00View.cpp
}
-Part in the screen where the keyboard is defined
extern Unicode::UnicodeChar keyboardBuffer[10];
void Screen02_00View::getBuffer() // added to manage the entered text from temperature keyboard
{
Unicode::UnicodeChar* buff = keyboard.getBuffer();
Unicode::strncpy(keyboardBuffer, buff, Unicode::strlen(buff) + 1);
}
-Part in screen.hpp
virtual void getBuffer(); //added to manage the keyboard entered text
-Part in the screen where I want to go when i pressed ok button and where i want to save the text edited
Unicode::UnicodeChar keyboardBuffer[10]; // at the beginning of the code
void Screen01View::updateScreen() // I've defined updateScreen from touchGFX
{
if(Unicode::strlen(keyboardBuffer) > 0)
{
memset(&BakeText3Buffer, 0, BAKETEXT3_SIZE);
Unicode::strncpy(BakeText3Buffer, keyboardBuffer, BAKETEXT3_SIZE - 1);
BakeText3Buffer[BAKETEXT3_SIZE-1] = '\0'; // make sure last index is null
BakeText3.invalidate();
}
}
Part in the screen01.hpp
virtual void updateScreen();
Could you please help me?
Thank you
This is my keyboard:
