How Do I Set Logic to Be Executed When the End User Enters/Leaves a Control? (Magic xpa 3.x)
Much of your online programming logic will probably be executed when the user enters or leaves a field. For instance, when the user enters a field you may want to display some helpful text or automatically pop up a list of choices. When the user leaves a field, you may want to execute a function to do some computations, or validate what the user just entered.
This sort of logic is entered in the Control Prefix and Control Suffix logic units.
-
Press Ctrl+H to create your logic unit header line.
-
Type C to select the Control handler. You will jump to the next field.
-
Type P to select Prefix from the second drop-down box. You will jump to the next field.
-
Zoom to select the desired control from a list of your current controls. If the control doesn’t exist yet, or is out of scope, you can just type in the name.
-
Enter the operations you want to execute, in the newly created logic unit.
Now, the logic you entered will only be executed when the user lands on the specified control.
-
Press Ctrl+H to create your logic unit header line.
-
Type C to select the Control handler. You will jump to the next field.
-
Type S to select Suffix from the second drop-down box. You will jump to the next field.
-
Zoom to select the desired control from a list of your current controls. If the control doesn’t exist yet, or is out of scope, you can just type in the name.
-
Enter the operations you want to execute, in the newly created logic unit.
Now, the logic you entered will only be executed when the user leaves on the specified control.
Note: Control Suffix and Control Verification may seem similar, but they work quite differently. Control Suffix will always execute when the user leaves the control. But Control Verification will also execute when the user moves past the field, whether or not they landed on it. Use Control Verification when, for instance, you want to make sure a field was not left blank before a record is stored.
The Online and Rich Client Samples projects (program LG11 and RLG11)