2021-08-11 02:57 AM
Hello,
I am trying to change the button labels dynamically through wildcard buffers, but the labels are not updated at all,
Unicode::UnicodeChar txtBufferButton1[3];
Unicode::UnicodeChar txtBufferButton2[3];
char* data = "abc";
//trying text label update (not working)
button1.setWildcardTextBuffer(txtBufferButton1);
Unicode::strncpy(txtBufferButton1, data , 3);
button1.invalidate();
//trying int value update (not working)
button2.setWildcardTextBuffer(txtBufferButton2);
Unicode::snprintf(txtBufferButton2, 3, "%d", 123);
button2.invalidate();
These buttons are defined as shown here:
button1.setBitmaps(Bitmap(BITMAP_BTN_BG_DEFAULT_ID), Bitmap(BITMAP_BTN_BG_SECONDARY_ID));
button1.setBitmapXY(0, 0);
button1.setWildcardText(TypedText(T_CPSELECTBUTTON1));
button1.setWildcardTextPosition(0, 25, 68, 68);
button1.setWildcardTextColors(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255), touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
button1.setIconBitmaps(Bitmap(BITMAP_NO_ICON_ID), Bitmap(BITMAP_NO_ICON_ID));
button1.setIconXY(0, 0);
button1.setPosition(20, 100, 68, 68);
button1.setAction(flexButtonCallback);
and same for button2.
Any help would be greatly appreciated.
Regards
2021-08-11 07:02 AM
Button is two image object. When you need text use button with label ...