Hello Natali
I think it does not work because your flexbutton is inheritated from more than one class. So 'touchgfx::WildcardTextButtonStyle' is most likely not proper type definition for your flexButton.
Check your base.hpp file to see how your flexButton defined. If you check 'text' and 'box with border' properties, it will be like:
touchgfx::WildcardTextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::ClickButtonTrigger > > flexButton1;
so this works like:
Screen1View::Screen1View()
{
static touchgfx::Unicode::UnicodeChar testUnicodeBuffer[10]; // Must static or global since this buffer is set as buffer for flexButton1
char charBuf[10]={"TESTTEXT"};
FlexButtonSetText(flexButton1,testUnicodeBuffer,charBuf);
}
void Screen1View::FlexButtonSetText(touchgfx::WildcardTextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::ClickButtonTrigger > > &FlexBtn, touchgfx::Unicode::UnicodeChar *UnicodeText , char * text )
{
Unicode::fromUTF8( (uint8_t *)text , UnicodeText , strlen(text)+1 );
FlexBtn.setWildcardTextBuffer(UnicodeText);
FlexBtn.invalidate();
}
Please check this thread also, it might help you:
https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/how-do-i-trigger-a-new-virtual-function-when-a-touch-button/td-p/52581
Anycase I don't know how useful this function is, though, because it overwrites the original wildcard buffer of flexButton. But hope this helps you
BR JTP