Skip to main content
SGian.1
Associate III
January 14, 2022
Solved

buttonwithlabel change text

  • January 14, 2022
  • 2 replies
  • 1593 views

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

This topic has been closed for replies.
Best answer by Romain DIELEMAN

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

2 replies

Romain DIELEMAN
Romain DIELEMANBest answer
ST Employee
January 17, 2022

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
SGian.1Author
Associate III
January 17, 2022

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

again thanks a lot

Sergio