2024-11-01 06:51 AM
Hi there Touchgfx team!
I need to trigger a modal in 15 different screens, like this:
I had a similar question on another post, and the solution works if I use buttons, but not if I send the notification from the model, which is what I need.
If I use a button like this the resulting screen is the one above.
If I create an interaction on the screen, that when called changes the screen to the modal, this is what happens:
What I need is to call the interaction from the model, not to use a button. But the result is different than expected.
Thanks a lot in advance!
Solved! Go to Solution.
2024-11-01 07:16 AM - edited 2024-11-01 07:17 AM
You can create a container for your popup/modal.
If you set its background to semi transparent greyscale it will darken its background (which is your current screen).
You add the this container as the top element, but set it to invisible in TouchGFX. If you need to show it you can set it to visible in your application.
2024-11-01 07:16 AM - edited 2024-11-01 07:17 AM
You can create a container for your popup/modal.
If you set its background to semi transparent greyscale it will darken its background (which is your current screen).
You add the this container as the top element, but set it to invisible in TouchGFX. If you need to show it you can set it to visible in your application.
2024-11-01 10:21 AM
I have 15 different screens with 3 different modals, so I'm looking for a more streamlined way to do it.
The other post suggested creating a separate screen for each modal. That works really good because I only need to create the notify function for each screen. But the problem is that it only works with the buttons, and not when sending a notify from the model.
2024-11-04 04:18 AM
@JPabl.1 wrote:But the problem is that it only works with the buttons, and not when sending a notify from the model.
It should work. You can add the notify as a virtual method in modellistener and implement it in the presenters and view of each screen. In the presenter it should just be a call to the view method.
Something like:
//model.cpp:
m_modelListener->notify()
//modellistener.h:
virtual void notify() {}
//ScreenNamePresenter.hpp:
virtual void notify();
//ScreenNamePresenter.cpp:
void ScreenNamePresenter::notify()
{
view->notify();
}
//ScreenNameView.hpp:
void notify();
//view cpp:
void ScreenNameView::notify()
{
popup.setVisible(true);
popup.invalidate();
}
Let me know if it works.