Best of Support

When events are triggered on a Dialog

Issue

I have set up a number of Embedded Dialogs/Collections to which I would like to pass data when these Dialogs/collections are open. I am using a floating variable "XLabel" which is set with the OnChange event. It works the first time the sub-Dialog is opened. However, when I subsequently open the sub-Dialog, after opening an intervening Dialog which set XLabel differently, the command does not execute. I have duplicated the command to the OnEnter event and it works properly. My understanding is that the first time I click the sub-Dialog button, there is a "change" in status from "Unanswered" to "Answered" which triggers the event. However, when I subsequently click the sub-Dialog button, there is no change in the variable. And this is why I need to use the OnEnter or OnExit event. Is this also true for buttons? Do you need to use OnEnter or OnExit or can you just use the OnChange event? Could you perhaps clarify the distinctions between OnChange, OnEnter, and OnExit for variables? And similarly, the distinctions between OnLoad, OnUnload, OnEnter, and OnExit for sub-Dialogs?

 

Seth Rowland

Solution:

A nice way of seeing how the events get fired is to create a simple Dialog with sub-Dialogs and to put %[MsgBox()] FillPoints into each event that show what happens, e.g., %[MsgBox("","OnUnload")] for the OnUnload event.

 

Here is a summary:

OnEnter: When the object/field gets the focus (is clicked on, tabbed to, etc.).

OnExit: When the object/field loses the focus, e.g., when you click somewhere else.

OnLoad: When the root Dialog is loaded (happens once only).

OnUnload: When the root Dialog is unloaded (happens once only).

OnChange: When something of the field changes, e.g., its value changes, it is a button and it is clicked, etc.

 

One typically uses OnChange the most as this event is fired when the user does things or changes things. OnEnter and OnExit are typically used for advanced input validation and real-time updating of the Dialog (e.g., hiding some fields or changing the label of another field, etc.). OnLoad and OnUnload are used only for initialization purposes of the root or main Dialog (the one that links all the others together). A good example of this is the way you use XLabel to change the RTF label to show the context of the Dialog.

 

Peter Ottermann