2020-03-30 06:37 AM
Hi everyone,
It's not unknown to people that TouchGFX designer is missing a key functionality: Grouping of views that have shared functionality, and separating the shared code into some interface. It's a feature that will appear in the Designer since it is currently not able to do this.
So far people are adding the same custom container to different views to achieve "shared" functionality, but this only takes care of the UI definitions and not code that could also be shared, like handlers for buttons (which had to be written again in each view).
A proper solution requires modifying the generated files, which will get overwritten again during the next code generation. Still, i've put together an example that you can look at to get a general overview. I'm attaching it here now, and will follow up with a detailed description of what's going on. I suppose we could consider this a pre-cursor to what will happen in the designer at some point and then you'll be READY and understand everything! =)
I will also write some scripts that you can use in your post-generate commands to modify groups of screens to inherit some common View AND presenter code. (e.g. A status bar and a presenter that can receive updates for it, completely abstracted away from the concrete views you're working on.
The Base View and Presenter must be written by hand, but i'll lay this out in what you need to consider here. You could use the designer to generate the view code and simply copy it. I'll build up the example as i go. This won't be required when the real features hits the designer, of course !: )
My plan is something like:
Let me know if there are other requests.
I'll update this thread as i go with improved functionality and project attachments. For now please find attached a project that will take you from screen1 to screen 2 to screen 3 to screen 1... (interactions and buttons for now) but using a shared BaseView interface that lets each screen set the color of their inherited TopBar. I'll get into details later.
Instructions:
Do not generate code from the TouchGFX designer or you'll overwrite the changes. I will come up with a script at some later time that you will insert into the post-generate-command to fix up all generated view groups.
To simply run the project without generating view code simply run this command from your TouchGFX environment:
make -f simulator/gcc/Makefile
Note: I removed anything but the win32 mingw simulator library to keep it small.
Below screenshots show two of the three screens in the application where each concrete View class calls a function defined in their base view to set the color of the inherited/shared top-bar.
/Martin
Solved! Go to Solution.
2022-07-15 06:25 AM
Hello,
Any news on this feature? It seems really interesting.
2022-09-07 12:58 AM
@Martin KJELDSEN
can we expect this feauture in next release ?
2022-09-07 01:18 AM
Hello @Community member ,
That is a big feature, and we want to do it right. So it might take some time.
Even though we are planning to work on it for further releases,
we cannot assure that it would be done for the next one, or give a accurate release date for that functionality.
/Yoann
2022-09-07 02:07 AM
@Yoann KLEIN thank you for the information. I wish you all success.
Regards,
Jure
2024-03-11 08:06 AM
Will this feature ever make it into the Designer? I understand that this will take some time, but the last answer was 1.5 years ago.
Another great possibility would be if the custom containers were simply given a presenter and could exchange data with the model via this.
Best regards
2024-04-04 12:43 AM
Hello! Will this feature ever make it into the TouchGFX Core?
This is greatly needed for big applications with (sometimes more than two) custom containers populating 75% of the screens.
Best regards!
2024-11-26 12:55 AM
Are there any news on this BaseClass/BaseView/CommonContainer feature?
It looks like it is in the works for 4.5 years. And as you said it can even be considered as a flaw. It is expected to have a battery, signal, etc. indicator in every screen of an application running on an STM.
2024-12-12 07:38 PM
May I know if there is any news, solutions or plan for this case? It is so wired to ctrl+c, Ctrl+v and rename the class names.