
Announcements
Hi everyone
is there a possibility to display some kind of warning if a user wants to leave a screen and moves to another screen via button.
Like „Changes may get lost, do you want to continue“ and then chose „Yes“ or „No,stay“,
Thank you very much!
Yes, you can pop up a message to tell the user this is about to happen.
Here are the steps.
1) Put a rectangle on the screen and make it fill the entire screen. Set the Fill property to RGBA(0,0,0,.53).
This will block the entire screen when your pop up message is shown. This is important as all the other controls on your screen would still be "active" when your pop up is shown. This rectangle will block them from being pressed.
Set the Visible property to lblPopup.Visible (this will show an error at this point and the rectangle will become invisible - don't worry about it, it will go away)
2) Place a Label on the screen and set the Text to lclPopUp (this will show an error at this point, but don't worry about it, it will go away). Make the label big and wide so that it looks like a box/window. Set the Fill property to White. And the BorderThickness to 2. Set the Alignment to Center and the Vertical alignment to Top. Adjust the Top, Bottom, Left and Right padding to suit your needs.
Set the Visible property of the label to !IsBlank(lclPopUp) (again, this will show an error at this point and the label will disappear)
3) Place Two buttons on the screen. Set text of one to "Cancel" the other to "Leave". Set the OnSelect property of the Cancel button to : UpdateContext({lclPopUp: Blank()})
On the OnSelect property of the Leave button, set the following formula: UpdateContext({lclPopUp: Blank()}); Back() (or Navigate(screenName) instead of Back() if you want to navigate some place)
Set the Visible properties of both buttons to : labelNameMadeInStep2.Visible
At this point, all the errors should be gone and the screen will have all of these controls invisible.
NOW...in your app where ever you want to have this appear. Simply use the following formula:
UpdateContext({lclPopUp: "whatever message you want to display to the user"})
Should give you what you need.
I hope this is helpful for you.