In addition to the solution sent by @KC using collections, you have a few additional options to reset the value of a toggle (or other) control - using it's Default property, and using its Reset property. In both cases, what needs to happen for the control to be notified is that the value of the property needs to change - if the value of the variable bound to the default property was set to true, for example, and you set it to true again, since nothing changed, then the control won't know that it needs to take action.
For example, if you have two toggle controls, whose default values are opposite. Their Default properties are set as follows:
Toggle1.Default: defValue
Toggle2.Default: !defValue
And if you want to always make the Toggle1 to be off (false) when the screen is shown, and the opposite for Toggle2, you need to make sure that the value of the `defValue` context variable is changed, which you can do by a couple of calls to UpdateContext:
Screen1.OnVisible: UpdateContext({defValue:true}); UpdateContext({defValue:false})(In some languages, you'll need to use the two semicolons - ;; - to separate the two UpdateContext expressions)
In this case, anytime you get to the screen, the value of the context variable defValue will change (if it was false, it will become true, and then false again; if it was true the first operation doesn't do anything, but the second changes its value), and that will mean that all controls that have properties bound to that variable will be notified of its change.
This works, but you add a dependency between the toggle (default property) and the screen (on visible) that may not be necessary. A better alternative would be to use the Reset property in the control. This way you can set the default property of the toggles the value that you want (i.e., false on Toggle1, true on Toggle2 on the example above), and set the controls Reset property to a value that would be triggered by a screen change:
Toggle1.Default: false
Toggle1.Reset: resetToggles
Toggle2.Default: true
Toggle2.Reset: resetToggles
Screen1.OnVisible: UpdateContext({ resetToggles: true }); UpdateContext({ resetToggles: false })In this case, since the value of the `resetToggles` context variable is changed (and momentarily becomes true), the controls will be notified that they need to be reset, and they do that by applying their default values again.