Skip to main content
Junde
Senior III
May 10, 2024
Solved

How to update textArea value in custom container?

  • May 10, 2024
  • 1 reply
  • 1265 views

Hi all,

I have create a custom container named "tableLine":

Junde_0-1715329850891.png

And using the "tableLine", I make a "table":

Junde_1-1715329996975.png

in "tableLine.cpp", I write the following code:

void tableLine::setLineContent(tableItem_t* item)
{
	Unicode::snprintf(txtIDBuffer, TXTID_SIZE, "%s", item->ID);
	Unicode::snprintf(txtTimeBuffer, TXTTIME_SIZE, "%04x%04x", item->date, item->time);
	txtID.invalidate();
	txtTime.invalidate();
	
#ifdef SIMULATOR
	touchgfx_printf("setLineContent: %s %04x%04x\n", item->ID, item->date, item->time);
#endif
}

And when I click the button "show data", the function "setLineContent()" will be called.

Both of the simulator and the MCU is work well except the table content has NOT display.

The simulator log as below:

Junde_2-1715330427148.png

I already read and try the tutorial-04 successfully, I think the situation is the same, but why my program can NOT work as my expectation.

Could you help me?

Thanks a lot.

 

This topic has been closed for replies.
Best answer by Junde

Maybe I forget to set the character range...

Junde_0-1715334494488.png

And must change "setLineContent()" to below:

void tableLine::setLineContent(tableItem_t* item)
{
	//Unicode::snprintf(txtIDBuffer, TXTID_SIZE, "%s", item->ID);
	Unicode::strncpy(txtIDBuffer, item->ID, TXTID_SIZE);
	Unicode::snprintf(txtTimeBuffer, TXTTIME_SIZE, "%04X%04X", item->date, item->time);
	txtID.invalidate();
	txtTime.invalidate();
	
#ifdef SIMULATOR
	touchgfx_printf("setLineContent: %s %04X%04X\n", item->ID, item->date, item->time);
#endif
}

 

1 reply

Junde
JundeAuthorBest answer
Senior III
May 10, 2024

Maybe I forget to set the character range...

Junde_0-1715334494488.png

And must change "setLineContent()" to below:

void tableLine::setLineContent(tableItem_t* item)
{
	//Unicode::snprintf(txtIDBuffer, TXTID_SIZE, "%s", item->ID);
	Unicode::strncpy(txtIDBuffer, item->ID, TXTID_SIZE);
	Unicode::snprintf(txtTimeBuffer, TXTTIME_SIZE, "%04X%04X", item->date, item->time);
	txtID.invalidate();
	txtTime.invalidate();
	
#ifdef SIMULATOR
	touchgfx_printf("setLineContent: %s %04X%04X\n", item->ID, item->date, item->time);
#endif
}