THIS Object Reference Example

The following example creates a subclass called MyForm, based on the Form class. A method called ChangeBackColor is created. ChangeBackColor uses THIS to refer to MyForm.

DEFINE CLASS MyForm AS FORM
 CAPTION = "This Form"
 HEIGHT = 15
 WIDTH = 20

 PROCEDURE ChangeBackColor
 PARAMETER NewColor
  THIS.BACKCOLOR = NewColor
 ENDPROC
ENDDEFINE