cancel
Showing results for 
Search instead for 
Did you mean: 

I want to know how to use "Wildcard" in "Text Area" of container.

mSH.1
Associate III

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.

0693W00000QKvuyQAD.jpg

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.

-> https://support.touchgfx.com/4.20/docs/development/ui-development/ui-components/containers/container​

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.

3 REPLIES 3
Pirol
Associate III

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);
}

0693W00000QKwkpQAD.png

MM..1
Chief II

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.

Osman SOYKURT
ST Employee

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

Osman SOYKURT
ST Software Developer | TouchGFX