Skip to main content
JPabl.1
Associate III
October 24, 2024
Solved

how to trigger modal in all screens from the model

  • October 24, 2024
  • 2 replies
  • 1986 views

Hi there Touchgfx team!

 

I have about 15 different screens. I also have a modal that says "battery critical level". I know how to propagate a notification from the model to the view to trigger this modal. 

My question is: is there an easy way to do this for 15 different screens? or everytime I need to override the notification function in each screen? 

Thanks a lot in advance

Best answer by ferro

@JPabl.1  Ah, sorry...forgot assets are also a must. try this one.

2 replies

ferro
Lead
October 25, 2024

Hi @JPabl.1 , one solution could be a new screen, just with that warning message window and transparent background and transition to that. Then back to original screen.

JPabl.1
JPabl.1Author
Associate III
October 25, 2024

Hi @ferro , thanks for the reply. 

 

I think that might work if the modal were just a single screen, but the UI requirements is for it to pop up on top of the current screen, like this: 

JPabl1_0-1729876995759.png

From your answer it seems the only way will be to the same on all screens?

 

ferro
Lead
October 25, 2024

Hi @JPabl.1 

 

but the UI requirements is for it to pop up on top of the current screen

 

Yes, and that is exactly what will happen. But I forgot one important detail.

Before transitioning to the warning screen, You must set the size of the default background box, named __background, injected automatically by Gfx Designer ( I suppose you use screen Base clasess) to the size of your modal widget. In that case, the previous screen content stays as it is ( in frame buffers).

 

From your answer it seems the only way will be to the same on all screens?

 

If you could rephrase that please, do not inderstand what you mean.

 

I've just remembered this post

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/persistent-widgets-between-screens/m-p/690918

 

JPabl.1
JPabl.1Author
Associate III
October 30, 2024

How can I run that project? I get :

JPabl1_0-1730305127219.png

 

ferro
ferroBest answer
Lead
October 31, 2024

@JPabl.1  Ah, sorry...forgot assets are also a must. try this one.

JPabl.1
JPabl.1Author
Associate III
October 31, 2024

That will do the trick, thanks a lot!