[TouchGFX] Reusable Modal window on every screen?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-22 6:42 AM
Hi everyone,
I'm currently working on a project where the device has to continuously read files from USB but where a user can also plug the device into a computer and mount it as a USB device to transfer and delete files and what-not.
Now, I can detect when external power is plugged-in and want to show the user a modal dialog where they can choose what should happen next - "USB device mode" or "Standalone mode + charging".
This modal dialog, however, should be shown on (or be reachable from) each and every screen within the application.
Now, I came across two different solutions, both of which I do not particularly like:
- create a container for the modal, add some selection logic and put this container onto each screen. Now, I have two, first mind that I add this modal to every newly created screen, and second, I have to copy code to show and hide the modal to every view and presenter within the project (which doesn't feel all that portable).
- create a dedicated "USB mode selection" screen that is only in the application once and on detected USB connection, somehow store the screen that was active before I switched there. This would also lead to code duplication since every screen would need to remember to register as the previous screen so that it can be restored afterwards. This approach is also not maintainable since the base `Presenter` class does not know about the concept of a view at all - which means I cannot use the "central" `deactivate` method of the `Presenter`s' base class to store the last active screen. Furthermore, the Presenter Facet of a derived presenter doesn't know about the concept of a model, hence I could not call the model to store the last active screen
Is there any better way I am currently unaware of? What am I missing here?
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-15 2:23 AM
Hi, i'm facing same problem/doubts...
At the end, what solution did you choosed of above listed?... Or did you found a better solution?..
Thnx and regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-15 10:56 PM
Hi Roberto,
finally, I selected the second option above with a dedicated "mode selection" screen, since I figured for my application it is not critical to return to the previous screen in all cases. So, I store some of the more important screens as the previous one and for others I do not really care to restore them and select the home screen as a default screen to return to. Hope this helps.
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-11-15 11:23 PM
Ok, thnx!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-01 11:05 AM
Hello, I am having exactly the same problem and the same questions... Any help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-02 3:22 AM
Hi,
I'm not so expert with TouchGFX, so the only solution i found (for my application) it was to create a Modal window in all windows that need to support (i had just 3 screen that required). If more screens btw I think that solution proposed by M-Shiller it's the simplest and better then mine.
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-02 3:41 AM
Hello, but in my case, I really need to use the Modal window, so M-Shiller solution is not good for me.
My current solution is to create a Popup class (ModalWIndow) and add it manually by heritage to all the screens, but the application is getting bigger and I think it's not a good approach because ill have a lot of duplicated code.
I was wondering if I can use some common class to add the modaWindow custom container to all the screen, not sure if I can make it with the Front end application class
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-20 3:00 AM
AFAIK, there is no point in the inheritance hierarchy that reliably supports adding code to all Views.
