cancel
Showing results for 
Search instead for 
Did you mean: 

Update Text and Gauge Needle on multiple custom containers

Jtron.11
Senior

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jtron.11
Senior

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

 

 

View solution in original post

3 REPLIES 3
Jtron.11
Senior

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

 

 

PeterVang
ST Employee

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
Senior

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.