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:




Target Business Object Name


Target Command Name




<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 and ID3 will contain the business object and command that you are switching to.  ID4 contains where you came from.  Therefore you need to add two records to the virtual clipboard; one where ID4 equals OBJECT_NAME (the business object) and another where ID4 equals COMMAND_NAME (the command). 

1.   Display the Source tab of the Departments' Details command handler.

2.   In the Button_1.Click event, before the avSwitch command, write this code to add the appropriate records to the switch history: 


* Save to clipboard return list

#avframeworkmanager.avsavevalue WithID1(SWITCH_HISTORY) WithID2(EMPLOYEES) WithID3(DETAILS) WithID4(OBJECT_NAME) FromAValue(#com_owner.Avobjecttype)

#avframeworkmanager.avsavevalue WithID1(SWITCH_HISTORY) WithID2(EMPLOYEES) WithID3(DETAILS) WithID4(COMMAND_NAME) FromAValue(#com_owner.avcommandtype)

Use your business object name for the WithID2() parameter.

Note that the actual business object name and command name are placed in the clipboard using the FromAValue parameter.  Notice how 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. 

Your code now looks like this:


3.   Compile the command handler.

4.   Close the command handler.