cancel
Showing results for 
Search instead for 
Did you mean: 

How to update textArea value in custom container?

Junde
Senior III

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Junde
Senior III

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
}

 

View solution in original post

1 REPLY 1
Junde
Senior III

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
}