Skip to main content
V.H
Senior
September 2, 2022
Question

Dynamic create widget by 'new' and 'delete', the project crash!

  • September 2, 2022
  • 2 replies
  • 3885 views

Hello all,

I dynamic create widget by 'new' and delete by 'delete', but the project crash when delete it.

Are there any examples of that used ?

I have 100 custom containers in a screen, but only one will be displayed at a time.

So I dynamic create one of these custom containers when used and delete when unused.

This topic has been closed for replies.

2 replies

Yoann KLEIN
ST Employee
September 2, 2022

Hello @V.H​ ,

Could you please share your whole project ? Not only the UI files.

Thanks,

/Yoann

Yoann KLEINST Software Developer | TouchGFX
V.H
V.HAuthor
Senior
September 6, 2022

I upload my project, now. That's a little big so I just upload the UI file before.

This problem has been bothering me for a long time and has not been properly solved. Help me, please.

V.H
V.HAuthor
Senior
September 8, 2022

Any Ideas?​

Yoann KLEIN
ST Employee
September 21, 2022

Hello @V.H​ ,

I investigated but didn't find the issue, your code seems correct to me.

After discussing with colleagues, they only said that it is not recommended to dynamically create widgets, because TouchGFX is allocating statically memory.

So, we strongly recommend people to create their widgets manually in TouchGFXDesigner, set them at non-visible and then show them at runtime.

We know that some customers like you have a lot of widgets they want to create dynamically, so we encourage instead at factorizing and reducing the number of widget, and then dynamically change the data displayed inside.

Hope that you will find a solution,

/Yoann

Yoann KLEINST Software Developer | TouchGFX
V.H
V.HAuthor
Senior
September 22, 2022

Hi @Yoann KLEIN​ 

1, It create a screen with a button at system start;

2, Click the button to new a "Modal Window" with a gray image;

3, Click area without the the gray image to return then delete;

0693W00000SvwbzQAB.png0693W00000Svwc9QAB.png0693W00000SvwcEQAR.png