2019-03-13 01:14 AM
Hi folks,
I'm trying to add a set of objects (in this case: a circle) to the GUI, as soon as the user presses a button. Therefore, I'm trying to execute the following code on the button press:
touchgfx::Circle circle2;
touchgfx::PainterRGB565 circle2Painter;
circle2.setPosition(309, 136, 90, 90);
circle2.setCenter(45, 45);
circle2.setRadius(40);
circle2.setLineWidth(10);
circle2.setArc(0, 280);
circle2.setCapPrecision(180);
circle2Painter.setColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
circle2.setPainter(circle1Painter);
add(circle2);
circle2.invalidate();
As soon as the button is pressed, the system won't react anymore. The "clicked_button" bitmap is displayed, nothing else happens.
What am I missing out? Is it actually possible to add GUI-objects at runtime? Is the buffer to small?
Thanks for your help!
2019-04-03 02:03 AM
Hi @t.albrecht,
Are you still having this problem? Did you try increasing the size of the buffer?
2019-04-03 02:08 AM
And it's possible to add objects at runtime as long as they are statically allocated (default). TouchGFX measures the size of your View/Presenter and will reuse that memory for other screens. Move the declaration of circle2 to your headerfile, the definition to setupScreen() of your view and then add it on button click.
Let me know.
2019-04-03 02:39 AM
Hi @Martin KJELDSEN ,
thank you for your answer.
In the meantime, we have resigned from using TouchGFX for our work, as we faced too many hurdles on the way of our specific project.
With kind regards,
Tillmann Albrecht
2019-04-03 03:35 AM
Hi @t.albrecht,
Sorry to hear that. Are you interested in sharing some of those hurdles?
Thank you!
Best regards,
Martin
2019-04-03 04:29 AM
Hi, @Martin KJELDSEN
sorry again, but unfortunately, I can't do that, as this is a confidential project of our customer.
Best regards,
Tillmann
2019-04-03 04:33 AM
I understand. Good luck :) Let me know if there's anything you need help with.
Best regards,
Martin
2019-07-31 11:21 PM
Hello@Martin KJELDSEN
I had the same question, and I adopted the method you proposed. I wrote the declaration of circle on headerfile, and the definition on the function of button click. But I clicked the button, the circle didn't show on the screen.
What am I missing out. Are there other methods to add GUI-objects at runtime?
Thanks for you reply!
2019-08-05 06:10 AM
Can you show me the code? Maybe you didn't invalidate the area covered by the Circle.
2019-08-07 07:18 PM
@Martin KJELDSEN Thank you reply.
First, I wrote below declaration on header file ( Header Files/generated/gui_generated/main_screen)
and I typed definition of the object on the click button function (Source files/generated/gui_generated/main_screen)
But ,after I clicked the button, the circle didn't show on the screen.
Can you teach me what process I may miss?
Thanks for you reply!