Hi David
Thanks again for responding. So what I have understood from the undermentioned is that CREATEOBJECT() and NEWOBJECT() can be used interchangably (with their own pros and cons), but for, for eg., building builders and setting properties, methods ADDOBJECT() is unavoidable.
Please correct me if I am wrong.
>AddObject() puts the object into the containership hierarchy. This allows and is required for the object to be visible and to participate in the UI event loop in the case of a form.
>
>assuming your form has a property LabelX:
>
>
thisform.LabelX = CreateObject( "label" )
>
>You can not make this label visible, nor will it respond to mouse clicks. The label object itself does not have a valid object reference in the .Parent property. You are responsible to set thisform.LabelX = .null. at some point during the destruct sequence to properly clean up the object. The form.Objects[] collection does not contain a reference to the label. The same comments apply if you use NewObject() instead of CreateObject().
>
>
thisform.AddObject( "LabelY", "label" )
>thisform.Visible = .t.
>
>
>The object LabelY can receive UI events, it's .Parent property references the form. You can access the label via the form.Objects[] collection. When the form destructs it will automatically take care of the destruction of the object.