Skip to main content
Jtron.11
Senior
September 10, 2025
Solved

Update Text and Gauge Needle on multiple custom containers

  • September 10, 2025
  • 3 replies
  • 494 views

Hi all, 

Can you please give me some pointers how to update the text and needle positions on the custom containers?

I have a gui that has multiple images, exactly the same text and gauge positions.  I created the custom container that has different text fields and one gauge.

With single gauge and multiple text fields on the same view, I am successfully update these peripherals, but when I create multiple copies of the same custom containers I lost, and I don't know how to access the text fields and gauge's needle.

For example:

I created customContainer = 2 text fields and 1 gauge

In then mainView I have customContainer1, customContainer2, customContainer3 and I don't know how to access those text fields and the the gauge.

thank you for your time.

 

Best answer by Jtron.11

I found a way to implement multiple buttons from this #2 inspiration 

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/multiple-custom-container-with-flexbutton-callbacks/td-p/676921 

Then i add the helper function from customContainer base, the confusion is understand how to replicate the customContainer

 //A helper to update text in customContainer header file
 virtual void Text(int val);
//A function in .cpp
void customContainer::updateIntensityText(int val)
{
 Unicode::snprintf(textAreaIntensityBuffer, TEXTAREAINTENSITY_SIZE, "%d", val);
 textAreaIntensity.invalidate();

 gauge.setValue(val);
 gauge.invalidate();
}

 

 

3 replies

Jtron.11
Jtron.11AuthorBest answer
Senior
September 12, 2025

I found a way to implement multiple buttons from this #2 inspiration 

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/multiple-custom-container-with-flexbutton-callbacks/td-p/676921 

Then i add the helper function from customContainer base, the confusion is understand how to replicate the customContainer

 //A helper to update text in customContainer header file
 virtual void Text(int val);
//A function in .cpp
void customContainer::updateIntensityText(int val)
{
 Unicode::snprintf(textAreaIntensityBuffer, TEXTAREAINTENSITY_SIZE, "%d", val);
 textAreaIntensity.invalidate();

 gauge.setValue(val);
 gauge.invalidate();
}

 

 

ST Employee
September 12, 2025

It looks like found the same solution to update fields inside a custom container as I would have suggested.

Can you explain more about what you now are confused about?

Jtron.11
Jtron.11Author
Senior
September 12, 2025

Hi Peter,

Thank you for checking.  It was a comment that I was confused because of multiple instances of the customContainer but not anymore after I understand the concept.