Skip to main content
DSand.5
Associate II
March 29, 2022
Question

Updating to TouchGFX 19.0 makes flexbutton wildcard text not appear.

  • March 29, 2022
  • 9 replies
  • 2423 views

I just updated TouchGFX to 19.0 and I am having an issue with my FlexButtons. I have found that when I have a flexbutton contain text and it is populated by a wildcard, it will no longer show the wild card text, even if I don't update the text in code and use the default value. However, If I add text and make it static, it works fine.

One other thing I tried was having a mix of static text and wildcard text on the same button (eg. "test<value>") and made the default value equal to "test2". So the expected outcome would be "testtest2", instead I just see "test".

Also, all of this code worked fine on 18.0 and 18.1. Can anyone help me at all with this?

This topic has been closed for replies.

9 replies

Yoann KLEIN
ST Employee
March 31, 2022

Hello @DSand.5​ ,

TouchGFX team is aware of that bug, and currently working on solving it. It will be fixed in the next release (4.19.1).

In the meantime, you can use a small work-around to fix the issue yourself :

  • In Screen1View.cpp class, if you want to display your default wildcard value, add the following code in the setupScreen() method. Please note that the enum "T___SINGLEUSE_RYAC" is the reference of your wildcard default text value.
void Screen1View::setupScreen()
{
 Screen1ViewBase::setupScreen();
 
 Unicode::snprintf(flexButton1Buffer, FLEXBUTTON1_SIZE, "%s", touchgfx::TypedText(T___SINGLEUSE_RYAC).getText()); //Put wildcard default value is the buffer
 flexButton1.setWildcardTextBuffer(flexButton1Buffer); //Link the wildcard buffer with flexButton1Buffer
}
  • Then, if you want for instance update the wildcard with a integer value, you can simply write the value you want inside the buffer and update the screen with invalidate(). For example :
void Screen1View::IncreaseCounter()
{
 cmpt++; // Increments a counter everytime the button is clicked
 Unicode::snprintf(flexButton1Buffer, FLEXBUTTON1_SIZE, "%d", cmpt);
 flexButton1.invalidate(); //Refresh the value on the screen
}

Hope that this helped,

/Yoann

Yoann KLEINST Software Developer | TouchGFX
DSand.5
DSand.5Author
Associate II
March 31, 2022

I have tried this (specifically the second one) and it still does not work. That is how my project is already set up to run. I replace the text into the buffer and then invalidate it.

Any idea when the next release is coming out?

Yoann KLEIN
ST Employee
April 1, 2022

Hello @DSand.5​ ,

For the first part, please note that T___SINGLEUSE_RYAC is the identifier of my wildcard default value, it can be something totally different for you. So you can try to display the different enums in the texts/TextKeysAndLanguages.hpp file.

For the second point I mentioned, the use of a counter to update the wildcard value was just an example of what you can implement.

The next release should come out next week.

In any case, I will attach the entire example project to this post, so you can understand better.

/Yoann

Yoann KLEINST Software Developer | TouchGFX
DSand.5
DSand.5Author
Associate II
April 4, 2022

what I meant about the second part is that I am doing what you mentioned and it still is not updating the text.

DSand.5
DSand.5Author
Associate II
April 5, 2022

So I tried the project and it did work. However I tried adding the fix to my personal project and it still is not working. Am I missing something?

#include <gui/containers/DrinkSettingsListItem.hpp>
 
DrinkSettingsListItem::DrinkSettingsListItem()
{
 
}
 
void DrinkSettingsListItem::initialize()
{
 DrinkSettingsListItemBase::initialize();
 drinkNameFlexButton.setWildcardTextBuffer(drinkNameFlexButtonBuffer);
}
 
void DrinkSettingsListItem::setDrinkLineInfo(string name, string description)
{
	Unicode::snprintf(drinkNameFlexButtonBuffer, DRINKNAMEFLEXBUTTON_SIZE,name.c_str());
	Unicode::snprintf(drinkDescriptionTextAreaBuffer, DRINKDESCRIPTIONTEXTAREA_SIZE,description.c_str());
	drinkNameFlexButton.invalidate();
}
 
//Setting up the title button callback that will be called from the main screen view (owner of container)
void DrinkSettingsListItem::setAction(GenericCallback< DrinkSettingsListItem& >& callback){viewCallback = &callback;}
 
void DrinkSettingsListItem::drinkSelected()
{
//		touchgfx_printf("profile button Clicked\n");
	// Inform the view of the event
	 if (viewCallback->isValid())
	 {
	 viewCallback->execute(*this);
	 }
}

DrinkListItem is in a container. I call the function setDrinkLineInfo on main screen load. This should populate the flex button and a label with info. As you can see, I added the "setWildcardTextBuffer" function call in the initialize function, but this still does not work. I also invalidated the button here, and invalidated the whole screen in the main view. Am I missing something?

Yoann KLEIN
ST Employee
April 6, 2022

Hello @DSand.5​ ,

I think your call to Unicode::snprintf() might be false, because you miss the "const UnicodeChar *format" parameter, which specifies what type of data you wanna print in the buffer (Support formats: %c (element type: char), %s (element type: null-terminated UnicodeChar list), %u, %i, %d, %o, %x (all these are integers formatted in radix 10, 10, 10, 8, 16 respectively).

If you want to print a string in the buffer, it should be like this :

Unicode::snprintf(drinkNameFlexButtonBuffer, DRINKNAMEFLEXBUTTON_SIZE, "%s", name.c_str());

If that doesn't fix the issue, could you please attach your project to this post ?

Thanks,

/Yoann

Yoann KLEINST Software Developer | TouchGFX
DSand.5
DSand.5Author
Associate II
April 6, 2022

No, making that change did not fix it.

Sadly, this is for a client and I cannot release the code. I can perhaps try and modify it to remove most of it except for the scenes that matter.

Are you still on schedule for the updated touchgfx release?