2022-03-29 02:36 PM
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?
2022-03-31 02:06 AM
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 :
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
}
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
2022-03-31 08:16 AM
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?
2022-04-01 12:52 AM
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
2022-04-04 12:41 PM
what I meant about the second part is that I am doing what you mentioned and it still is not updating the text.
2022-04-05 12:17 PM
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?
2022-04-06 01:50 AM
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
2022-04-06 11:01 AM
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?
2022-04-08 06:31 AM
Hello,
The next version should be released at the beginning of next week.
Please let me know if this new release solved your issue or not.
/Yoann
2022-12-12 01:54 AM
The problem still remains in 4.20. I have a flexbutton and I change the bitmap image of the flexbutton and invalidate it. after that the text disapears...