Can't recognize numbers with Unicode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-05 01:48 AM
Hi,
I'm building a program which has a part that is similar to the "Flex Button Example".
In my case I've got a problem with Unicode. My program works the same as the image above. When I reach to number 24, 26, 28, 29, this is what it shows:
This is my code:
touchgfx::TextAreaWithOneWildcard texto;
touchgfx::Unicode::UnicodeChar* memoria;
int tama;
IP_AdressView::IP_AdressView()
{
}
void IP_AdressView::adress1_button_pressed()
{
adress1_button.setBoxWithBorderColors(touchgfx::Color::getColorFrom24BitRGB(169, 172, 173), touchgfx::Color::getColorFrom24BitRGB(169, 172, 173), touchgfx::Color::getColorFrom24BitRGB(0, 0, 0), touchgfx::Color::getColorFrom24BitRGB(0, 0, 0));
texto = adress1;
memoria = adress1Buffer;
tama = ADRESS1_SIZE;
buttonUppressed();
buttonDownpressed();
}
void IP_AdressView::buttonUppressed()
{
int tmpVal = Unicode::atoi(texto.getWildcard());
if (tmpVal >= 0)
{
tmpVal++;
Unicode::snprintf(memoria, tama, "%d", tmpVal);
texto.invalidate();
touchgfx_printf("%d\n", tmpVal);
if (tmpVal >= 300)
{
buttonUp.setAlpha(100);
buttonUp.setTouchable(false);
buttonUp.setPressed(false);
buttonUp.invalidate();
}
}
}
void IP_AdressView::buttonDownpressed()
{
int tmpVal = Unicode::atoi(texto.getWildcard());
if (tmpVal >= 0)
{
tmpVal--;
Unicode::snprintf(memoria, tama, "%d", tmpVal);
texto.invalidate();
if (tmpVal <= 0)
{
buttonDown.setAlpha(100);
buttonDown.setTouchable(false);
buttonDown.setPressed(false);
buttonDown.invalidate();
}
}
}
And then, when I print the number through the TouchGFX Terminal, it works fine:
I would appreciate your help.
Thanks,
Dani
Solved! Go to Solution.
- Labels:
-
TouchGFX
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-05 05:48 AM
Looks like the glyphs are missing. "?" is the default fallback character when TouchGFX can't find the glyph.
By default TouchGFX only includes the glyphs, from the font, that are required. When using wildcards you need to tell TouchGFX which glyphs it should include.
This is done in the Designer under typographies. I think it's called "wildcard ranges".
It's mentioned in this article: https://touchgfx.zendesk.com/hc/en-us/articles/207015345-Using-texts-and-fonts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-05 05:48 AM
Looks like the glyphs are missing. "?" is the default fallback character when TouchGFX can't find the glyph.
By default TouchGFX only includes the glyphs, from the font, that are required. When using wildcards you need to tell TouchGFX which glyphs it should include.
This is done in the Designer under typographies. I think it's called "wildcard ranges".
It's mentioned in this article: https://touchgfx.zendesk.com/hc/en-us/articles/207015345-Using-texts-and-fonts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-03-06 12:17 AM
It worked, that was the problem.
Thanks a lot!
