One of the coolest and easiest script trigger techniques is user interface navigation. I've often employed a technique I call a menu button, which allows you to have a pop-up menu and a single button control the actions of many buttons, thus saving valuable screen real estate. It requires a conditional script that contains as many nested If script steps as there are choices in the pop-up menu. After they've chosen an option from the pop-up menu, the user clicks the button next to it to perform the selected action.
Script triggers let you take the two or three clicks and a drag of the menu button to a single-click operation. In other words, the script is initiated by the modification of the object, or pop-up menu in this case, rather than a button.
Start by creating a global text field and attach a value list as a pop-up menu with the following items:
Your list can obviously include more choices but, for this example, I'll keep it simple. By the way, you'll also need two layouts with the names "Form" and "List".
Next, create a script with the following step (choose the option Layout Name by Calculation to enter the formula):
Go to Layout [MyTable::xPopup]
Finally, enter Layout mode and attach an OnObjectModify script trigger to the global pop-up menu you created earlier. You'll find the Set Script Triggers option under the Format menu. On Object Modify runs the attached script any time the object, or field in this case, is modified.
In this simple example, I'm showing only basic navigation between a List View layout and a Form View layout, but you could have the pop-up menu initiate more complicated scripts by wrapping Perform Script steps inside multiple If steps.
-- John Mark Osborne, www.databasepros.com