2022-09-20 06:00 AM
For a job commissioned by a client, do I need to add a widget on a page to Run-time.
If I don't find a solution, I'm forced to abandon TouchGFX (which I find very versatile), and migrate to another platform
Is there an example?
Is there any documentation on this?
Best regards
Domenico
2022-09-21 02:43 AM
Hello @DDi S.1 ,
That is possible with TouchGFX.
The most easy way to achieve that would be to create your widget manually in TouchGFXDesigner, hide it first by unchecking the "Visible" checkbox, and then show it on runtime by using Interactions>Action>Show widget.
If you want to do it through the code, you can use the setVisible(true) method.
I'll join a very simple example I just made for that, with a button on the screen which shows a hidden container after clicking on it. You can take a look a this project and ask me if you have some questions.
Hope that it helps,
/Yoann
2022-09-21 03:41 AM
I Yoann.
Thanks for the reply.
I had arrived on my own at a similar solution.
I have placed custom widgets outside the visible area, then at runtime, by simply repositioning the widgets, I can view the ones I need and in the position where I need them.
With these systems, however, I have to provide for each page (with a great waste of memory) all the possible widgets that the user could choose.
If, on the other hand, the widgets are placed in containers globally, could instances of these containers be invoked at runtime, in a page?
Best regards
Domenico
2022-09-21 04:46 AM
You can create Custom Containers, there you can put all the widgets you want.
Similarly, you can also make those containers visible at runtime.
Unfortunately, each widget/container belongs to only one screen in TouchGFX. That means that you cannot create a common widget for several screens.
FYI, we are planning to work on a common screen class, that will enable the user to share different characteristics (like widgets for example) between several screens. We are not sure when it will be released yet.
/Yoann