Fabio,
>why you have skip to comment this ?
>
>ox=CREATEOBJECT('textbox')
>? VARTYPE(OX.Parent)
>
I did comment on it in the rest of the discussion, let me try again and add a little more.
the above line creates an object outside any containership hierarchy, therefore its .Parent property does not contain a valid object reference
Now before we go farther, open the locals window and look at ox, you'll see that its current value for Parent is (none) and its type is empty. The parent property exists so vartype can not return U. Its value is not null so vartype could not return X.
It throws an error, because internally VFP knows that Parent is supposed to be an object reference but the value is in this limbo state because of the lack of containership. vartype() is not meant to deal with this invalid value situation.
Trying to do this throws errors too:
ox.Top = "test"
ox.Tag = 12345
VFP constrains all of the builtin properties of objects, .Top can not be set to anything but a number. .Tag can not be set to anything but a string.
? vartype( ox.ThisPropertyDoesntExist )
that returns U and it should. ox is a valid object, it does not have a property named ThisPropertyDoesntExist.
? vartype( ox.oShouldBeAnObjectReference.BaseClass )
throws an error because ox.oShouldBeAnObjectReference doesn't resolve to anything that can be used to get to a BaseClass property value.
ox.AddProperty( "oTest", .null. )
? vartype( ox.oTest.BaseClass )
Now the oTest property exists, but it has a null value, so again it can't be used to get to a BaseClass property value.
If you want to avoid the errors, use the type() function instead. It is designed to return U for all these indeterminate arguments.
The documentation should be updated to discuss this issue, but it is not a bug in the function itself.