Touchgfx print unicode problem
Good morning to all,
I am wanting to make a simple numeric keypad where I only press numbers and they are seen in a text area and then when I press a button it compares it with a char and if it is the same it does one thing or another.
My problem is that I can't see anything in the text area and if I send in the sprintf directly the variable contrasena_ing (which is of type char contrasena_ing[11]; ) it prints and the delete button erases but in fact it prints anything (from touch gfx the range of ascii characters is ok).
what am I doing wrong?
Info_5View::Info_5View()
{
}
void Info_5View::setupScreen()
{
Info_5ViewBase::setupScreen();
contrasena_ing[0] = '\0';
pos = 0;
}
void Info_5View::tearDownScreen()
{
Info_5ViewBase::tearDownScreen();
}
void Info_5View::service_unlock()
{
// Override and implement this function in Info_5
//Unicode::snprintf(unlock_textBuffer, UNLOCK_TEXT_SIZE, "%s",contrasena_ing);
//unlock_text.invalidate();
//char contrasena_ing[11];
}
void Info_5View::borrar_caracter()
{
if(pos > 0)
{
pos--;
contrasena_ing[pos] = '\0';
Unicode::UnicodeChar buffer[11];
Unicode::strncpy(buffer, contrasena_ing, 11);
Unicode::snprintf(unlock_textBuffer, UNLOCK_TEXT_SIZE, "%s",buffer);
unlock_text.invalidate();
}
}
void Info_5View::boton_0()
{
if(pos < 10)
{
pos++;
contrasena_ing[pos] = '0';
contrasena_ing[pos+1] = '\0';
Unicode::UnicodeChar buffer[11];
Unicode::strncpy(buffer, contrasena_ing, 11);
Unicode::snprintf(unlock_textBuffer, UNLOCK_TEXT_SIZE, "%s",buffer);
unlock_text.invalidate();
}
}
void Info_5View::boton_1()
{
if(pos < 10)
{
pos++;
contrasena_ing[pos] = '1';
contrasena_ing[pos+1] = '\0';
Unicode::UnicodeChar buffer[11];
Unicode::strncpy(buffer, contrasena_ing, 11);
Unicode::snprintf(unlock_textBuffer, UNLOCK_TEXT_SIZE, "%s",buffer);
unlock_text.invalidate();
}
}
I share a part of the code where it is tested with the number 0 and 1 for the moment but it would be from 0 to 9.
I don't care that when changing the screen the entered value is not saved, that's why I don't send anything to the model.cpp.
