Warn on navigating back
In certain situations it can be useful to prevent the user from exiting a page - Either by warning or by blocking.
The functionality can be enabled on all pages, but is most often used on the main menu, to allow aggressive back button action without logging out.
<page id="MainMenu" type="Menu" icon="icon"> <title defaultValue="Mobile WMS"/> <menuConfiguration> <menuItems> <menuItem id="Receive" displayName="@{MainMenuReceive}" icon="mainmenureceive"/> <menuItem id="PutAway" displayName="@{MainMenuPutAway}" icon="mainmenuputaway"/> ... </menuItems> </menuConfiguration> <warnOnNavigatingBack enabled="false" warningType="Block" title="Do not exit" message="You are not allowed to exit!"/> </page>
The element to add is called warnOnNavigatingBack, and is a sub element of the page.
Originally, it was implemented to only allow warning, which was done by the Enabled="true" attribute.
In a later improvement, this was changed to warningType="Block | None | Warn".
Therefore warningType="" takes precedence over enabled="".
Besides the warning type, a custom message and title can be set. If not, the default will be used.
The warning dialog looks as follows.
The blocking dialog looks a follows, with the custom title and message configured above.