Creating flexbuttons with code but don't know how to implement callback
Hi,
I am implementing a screen with particular number of flex buttons. The buttons are generated by my code and number of buttons change depending on some other variables. So far, I can create those flex buttons by code and see and touch them on the display. They change color when I touch them, so that I realise that buttons are functional. But of course, nothing happens when I touch them, because there are no callback functions. And I couldn't find a way how to implement callback function/functions for them.
Here is a part of my code, showing how I create those buttons:
for (uint8_t i=1; i<=numberoflines; i++)
{
Buttons[i].setBoxWithBorderPosition(0, 0, 337, 30);
Buttons[i].setBorderSize(0);
Buttons[i].setBoxWithBorderColors(touchgfx::Color::getColorFromRGB(0, 0, 0), touchgfx::Color::getColorFromRGB(150, 150, 150), touchgfx::Color::getColorFromRGB(80, 80, 80), touchgfx::Color::getColorFromRGB(150, 150, 150));
Buttons[i].setPosition(2, (i*30+5), 337, 30);
Buttons[i].invalidate();
scrollableContainer1.add(Buttons[i]);
Line[i].setPosition(42, (i*30+10), 294, 19);
Line[i].setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
Line[i].setLinespacing(0);
Unicode::snprintf(TextBuffer[i], 100, "TEST TEST %d %d", i, i);
Line[i].setWildcard(TextBuffer[i]);
Line[i].setTypedText(touchgfx::TypedText(1));
Line[i].invalidate();
scrollableContainer1.add(Line[i]);
}
scrollableContainer1.invalidateContent();
scrollableContainer1.invalidate();
Could you please help me to implement callback functions for those buttons?
Many thanks.
