cancel
Showing results for 
Search instead for 
Did you mean: 

buttonwithlabel change text

SGian.1
Senior

Hi there !

i'm gonna to 'play' with touchgfx , and after a help from community ii'm going to make my first program. And here i'm first problem. I wanto to change the name of a button after i touch and right now i just try to wrote that :

void Screen1View::btn1(){

buttonWithLabel1.setLabelText(touchgfx::TypedText('t'));

buttonWithLabel1.invalidate();

}

and i have a couple of question:

1) dosen't work and afther the first touch the button look like continus to be push

2) i want write one phraselike Stop but i don't know how to do

I hope some one can help me

Have a good day

Sergio

1 ACCEPTED SOLUTION

Accepted Solutions
Romain DIELEMAN
ST Employee

Hi,

I would not recommend to use the buttonWithLabel in that way, not sure it works. I would instead use the Ressource text source solution as done in the "Text Example" UI which you can find when creating a new project in the Example tab. In this demo the text source within the buttonWithLabel is not a Single Use but a Ressource, so already set within the text tab in Designer. It is easier to change and won't break your project.

Otherwise I would recommend to use a flex button widget and add the images and the text to mimic a buttonWithLabel widget. The flex button should be easier to manipulate.

Concerning your 2nd question, could you elaborate ? I am not sure I understand what you want to do.

/Romain

View solution in original post

2 REPLIES 2
Romain DIELEMAN
ST Employee

Hi,

I would not recommend to use the buttonWithLabel in that way, not sure it works. I would instead use the Ressource text source solution as done in the "Text Example" UI which you can find when creating a new project in the Example tab. In this demo the text source within the buttonWithLabel is not a Single Use but a Ressource, so already set within the text tab in Designer. It is easier to change and won't break your project.

Otherwise I would recommend to use a flex button widget and add the images and the text to mimic a buttonWithLabel widget. The flex button should be easier to manipulate.

Concerning your 2nd question, could you elaborate ? I am not sure I understand what you want to do.

/Romain

SGian.1
Senior

Thank you soo much, About the second question it was just an example about what i want wrote.

again thanks a lot

Sergio