TouchGFX change button text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-01 3:22 PM - edited ‎2024-05-01 3:36 PM
Hello, I try to do my own keyboard.
My idea: when click on shift button (red a, btnShift) i want replace big letters with small. All buttons are FlexButton
Can I use the Action Execute C++ code ?
like this:
btnA.setText(TypedText('a'));
but not woking now :(
Solved! Go to Solution.
- Labels:
-
TouchGFX
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-01 9:17 PM
Hello, Schamann.
To change the button text, you can use text resources to switch original texts to new texts.
This can be done by setting up wildcards and text resources.
If you want to change your text, you should open up your project and manually change the wildcard content.
In this way you'll be able to fix that bug.
If you find my answer useful, it'll be nice of you to click on "accept as solution".
Good luck.
Nathan Xi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-01 9:17 PM
Hello, Schamann.
To change the button text, you can use text resources to switch original texts to new texts.
This can be done by setting up wildcards and text resources.
If you want to change your text, you should open up your project and manually change the wildcard content.
In this way you'll be able to fix that bug.
If you find my answer useful, it'll be nice of you to click on "accept as solution".
Good luck.
Nathan Xi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-02 5:27 AM - edited ‎2024-05-02 5:30 AM
Hello @Schamann ,
As our friend @Nathan_Xi mentioned, the easiest way would be to define all the texts that you want to use in your GUI inside the TouchGFX Designer -> Texts. And also set the characters you want to use inside the wildcard range.
Afterward, in your code you need to include texts/TextKeysAndLanguages.hpp, then you can use the function you mentioned to change the label of the flex button. Keep in mind that you need to provide the ID that you assigned to your text inside TypedText().
It would look something like this:
Setting Wildcard ranges
Text definition inside TouchGFX
//Inside your ScreenView.cpp
#include <texts/TextKeysAndLanguages.hpp>
//An interaction set inside the designer for a button click
void ScreenView::changeLetterToSmall()
{
btnA.setText(TypedText(T_SMALL_A));
btnA.invalidateContent();
}
I hope this helps you, don't hesitate to ask more questions
ST Software Developer | TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-03 4:08 AM
Thank you for your replenish to this topic! @Mohammad MORADI ESFAHANIASL
It's essential to make replies comprehensively, and I'll pay attention to that in future replies;).
It's pretty nice of you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-03 7:37 AM
Thank you @Nathan_Xi, for participating in the community to make it better every single day. It's lovely to see individuals like you assisting others in achieving their goals.
Wish you the best!
ST Software Developer | TouchGFX
