2020-05-17 03:09 AM
Hello!
I tried to make menu with variable element headers.
I tried this code
const char* MenuItemList[10] = {"�?а�?тройки","Скоро�?ть","Extruders","LED Light","UPS","FirmWare","Language","Coolers","Drivers","WiFi"};
............................
Unicode::strncpy(buffer, MenuItemList[data], 20);
Unicode::snprintf(OptionsMenuItemtextAreaBuffer, 20, "%s", buffer);
OptionsMenuItemtextArea.setWildcard(OptionsMenuItemtextAreaBuffer);
Code works, but I got problems with cyrillic symbols.
My problem with cyrillic symbols solved only when I created text resource and make this code
OptionsMenuItemtextArea.setTypedText(TypedText(T_MENUITEM1_TEXT_RESOURCE));
OptionsMenuItemtextArea.invalidate();
How can I create array of links to text?
I want use text resources, created in TouchGFXDesigner and use it like this:
OptionsMenuItemtextArea1.setTypedText(TypedText(ARRAY[1]));
OptionsMenuItemtextArea2.setTypedText(TypedText(ARRAY[2]));
OptionsMenuItemtextArea3.setTypedText(TypedText(ARRAY[3]));
OptionsMenuItemtextArea4.setTypedText(TypedText(ARRAY[4]));
How can I create "ARRAY" ?
2020-05-17 05:14 AM
Hi,
Please check below working example with List Box but with textArea3Buffer not with text resources.
char Rx_Buffer1[11][20] =
{
"IMBUENT.bmp" , "HELLO.png" ,
"TouchGFX.txt" , "STM32F7.doc" ,
"SCROLL.bmp" , "NEW.xlsx" ,
"TRY.jpg" , "GOOD.bmp" ,
"ABC.png" , "XYZ.bmp"
} ;
void MenuElement::UpdateFileNameArrayInMasterList(int no)
{
memset( &textArea3Buffer , 0 , TEXTAREA3_SIZE) ;
touchgfx_printf("setNumber = %d\n" ,no) ;
// Unicode::itoa(no,textArea3Buffer, TEXTAREA3_SIZE , 10) ;
Unicode::strncpy(textArea3Buffer ,(char *) Rx_Buffer1[no] , TEXTAREA3_SIZE -1 ) ;
}
Check this link..
Hope this helps..
--
Karan