Step 4. Record Switch History using the Virtual Clipboard
In this step you will record the switch history using the virtual clipboard so that the end-user will be able return to the object that initiated the switch.
To use the virtual clipboard most effectively you need to devise a standardized naming protocol for items that are posted onto it. In this exercise you will use this standard to store the switch history:
ID1 |
SWITCH_HISTORY |
ID2 |
OBJECT_NAME/COMMAND_NAME |
FromAValue |
<object or command name> |
In effect you will be storing a switch history table on the clipboard. The first key or ID is the code SWITCH_HISTORY to indicate that all records with this ID are related to switching history.
The ID2 indicates whether you are switching to a business object or command. The actual business object name and command name are placed in the clipboard using the FromAValue parameter. You can use avobjecttype to get the current business object name and avcommandtype to get the current command name. You should not hard code these values.
1. Display the Source tab of the Sections’ Details command handler.
2. In the #avFrameworkManager.uWAMEvent_1 eventroutine, before the avSwitch command, write this code to add the appropriate records to the switch history:
#avframeworkmanager.avsavevalue WithID1(SWITCH_HISTORY) WithID2(OBJECT_NAME) FromAValue(#ThisHandler.avObjectType)
#avframeworkmanager.avsavevalue WithID1(SWITCH_HISTORY) WithID2(COMMAND_NAME) FromAValue(#ThisHandler.avCommandType)
Your code should now look like this:
3. Compile the command handler and check it in.
4. Close the command handler.