Passing Object Handles as a Parameter
The discussion of object IDs has been limited to using them to determine which object receives a message. In some cases, you may need to pass an object handle as a parameter within a message. In such a case, you must use the Move command to move the object ID to a handle variable and pass the variable. You may not pass the object name directly.
Correct and Incorrect Usage
The following example shows the right way and the wrong way to pass an object handle as a parameter. In this example, we are trying to send a message to oButton1, passing as a parameter the object handle of oButton2.
Correct Way
// This is the correct way
Procedure GoodAction
Handle hoButton2
Move oButton2 to hoButton2 // First move object handle to variable
Send NotifyButton of oButton1 hoButton2 // Then, pass the variable
End_Procedure
Incorrect Way
// This will NOT work. You will get a compile error…
Procedure BadAction
Send NotifyButton of oButton1 oButton2
End_Procedure