2022-07-12 03:20 AM
Hello
I want to know how to use "Wildcard" in "Text Area" of container.
Container is created as shown in the figure below.
We are going to use Text Area and WildCard for Container.
I'm trying to change the WildCard data by calling the Container created above in "Screens", but I don't know how.
The tutorial in the link below is only briefly shown.
I want to edit Wildcard in TextArea of Container in Screens with "snprintf" as shown below.
Unicode::snprintf(customContainer_Name.textArea_Name.textArea_kBuffer, customContainer_Name.textArea_hiddCook.TEXTAREA__SIZE, "%02d", (int)( data ));
Are there any resources to refer to?
thank.
2022-07-12 06:20 AM
You could have a look at TouchGFX Demo 4, see picture below. There are some containers with changing values.
I do it like this:
In MyContainer.cpp, there is a function for changing the wildcard values:
void MyContainer::updateTime(uint8_t hour, uint8_t minute)
{
touchgfx::Unicode::snprintf(textAreaClockBuffer1, TEXTAREACLOCKBUFFER1_SIZE, "%02d", hour);
touchgfx::Unicode::snprintf(textAreaClockBuffer2, TEXTAREACLOCKBUFFER2_SIZE, "%02d", minute);
textAreaClock.invalidate();
}
In Screen1View.cpp, there is a function using the previous one on the container on the screen:
void Screen1View::setTime(uint8_t hour, uint8_t minute)
{
myContainer1.updateTime(hour, minute);
}
2022-07-12 07:27 AM
C++ normal class variables is private then
customContainer_Name.textArea_Name.textArea_kBuffer
you can use only in container class. And here you can skip
this.textArea_Name.textArea_kBuffer
or
textArea_Name.textArea_kBuffer
result cant use private in other place.
One way poor is change it to public...
Second better way is in container class create public method for wildcards resp. textarea manipulate.
2022-07-15 01:53 AM
Hello mSH.1,
Changing a wildcard value inside a custom container is not very different as usual. I do the exact same as Pirol when I need to change wildcard value inside custom containers. Works 100% fine 🙂
/Osman