Skip to content

Other Object Access Methods

As you look through sample code and package code, you will see that objects are often accessed using an object access expression syntax. This syntax has the format of:

(objectName(Self)) or (ObjectName(Current_Object))

This is an older style of coding that, while still valid, has been replaced with the simpler methods discussed here. The following two code segments generate the same compiled code:

Send MyMessage of (oMyObject(Self))
Get MyProperty of (oMyObject(Self)) to iVar
Send MyMessage of oMyObject
Get MyProperty of oMyObject to iVar

The expression syntax must be used if you insist on accessing objects that are outside of an object’s neighborhood.

Move (oRadio1(oRadioGroup(oMyView))) to hoRadio1

The syntax can also be used to access an object by its absolute location:

Move (oRadio1(oRadioGroup(oMyView(oClientArea(oPanel(desktop)))))) to hoRadio1

The complexity of this code speaks for itself. It should and can be avoided. For more information regarding expression syntax, refer to Reading Properties using Expressions.

For more information regarding object neighborhoods, refer to Object Neighborhoods.