2024-05-10 01:45 AM
Hi all,
I have create a custom container named "tableLine":
And using the "tableLine", I make a "table":
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:
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.
Solved! Go to Solution.
2024-05-10 02:50 AM
Maybe I forget to set the character range...
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
}
2024-05-10 02:50 AM
Maybe I forget to set the character range...
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
}