How to Instantiate a TouchGFX object dynamically?
Hi, I use TouchGFX in my HMI project, I want to create an instance of an object (ig. a button) in runtime (dynamically), so I could destroy it later and free it's allocation memory.
I tried create it in a method but it seems to have runtime error:
void Screen1View::create_button()
{
touchgfx::Button button1;
button1.setXY(0, 0);
button1.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_ID),
touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_PRESSED_ID));
add(button1);
button1.invalidate();
}
Does anyone have any solution?
