How to display the same content in different screen of touchgfx?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-24 1:44 AM
Hi there,
I have a project with a display, and I want to show several screens.
All the screens have a time text at the top-left corner.
I know I can put a TextArea on all the screens, which means each one needs some memory to store the time value.
Is there any way, I can store the time in just one time, and display the time on any screen?
Thanks for your help!
Solved! Go to Solution.
- Labels:
-
STM32F4 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-29 1:34 AM
Yes, i created functions in the container and call the functions from all my views.
A general call would be great, but i think for that a lot rework needs to be done in the touchgfx structure.
Create functions for updating values and for show or hide images.
i.e. container:
void TopValue::updateValues(int value
{
Unicode::snprintfFloat(txtValueBuffer, TXTVALUE_SIZE, "\%.f", value);
txtValue.invalidate();
}
and in view i have some functions which are called by the main task, or you can use the handle tick event to update the top container:
topValue.updateValues(variableToUpdate);
Could be easier but once its done, thats ok. I created a template page and copied that for all new pages i created before implementing other functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-24 2:51 AM
I am using a container for "header" stuff which is visible on multiple pages.
then i update the value for the text areas in the container in each single view i need it.
Did not find any other way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-24 3:11 AM
Hello @Junde ,
If you are just concerned about memory space, you can simply save your time in the model.cpp and access it from any screen. This way, you store your data only once.
Also, as @Exit0815 said, it is a common practice to have a "header" (a custom container fitting your need) present on every screen and fetching its data from the model.cpp.
I hope this help! :smiling_face_with_smiling_eyes:
If this comment or another one answered your question, I invite you to select it as "best answer".
Regards,
Software engineer at ST (TouchGFX)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-28 8:17 PM
thanks for your reply, it's help me a lot!
If the header also need some image to show the remainder battery.
Is this way can work out?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-29 1:34 AM
Yes, i created functions in the container and call the functions from all my views.
A general call would be great, but i think for that a lot rework needs to be done in the touchgfx structure.
Create functions for updating values and for show or hide images.
i.e. container:
void TopValue::updateValues(int value
{
Unicode::snprintfFloat(txtValueBuffer, TXTVALUE_SIZE, "\%.f", value);
txtValue.invalidate();
}
and in view i have some functions which are called by the main task, or you can use the handle tick event to update the top container:
topValue.updateValues(variableToUpdate);
Could be easier but once its done, thats ok. I created a template page and copied that for all new pages i created before implementing other functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-30 12:01 AM
Thanks for your advices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-30 2:07 AM
Hello @Junde ,
Yes, it would work too. When starting your screen, you will have to show the correct image according the the battery value. All the images are accessible from every screen. Look at this forum post to see how to change an image at runtime : change-image-at-runtime .
Regards,
Software engineer at ST (TouchGFX)
