Skip to main content
May 17, 2020
Question

Array of typed text. How?

  • May 17, 2020
  • 1 reply
  • 756 views

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" ?

This topic has been closed for replies.

1 reply

Karan 123
Senior
May 17, 2020

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..

https://community.st.com/s/question/0D73W000000PndH/scroll-list-select-highlight-on-click-remove-and-add-elements-how-to?s1oid=00Db0000000YtG6&s1nid=0DB0X000000DYbd&emkind=chatterCommentNotification&s1uid=0050X000007vw7K&emtm=1589275869718&fromEmail=1&s1ext=0

Hope this helps..

--

Karan