Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test If a Variable exists
Message
From
02/09/2006 18:33:09
 
 
To
02/09/2006 03:34:55
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01150290
Message ID:
01150566
Views:
26
Thanks. That's what I thought. The variable exists, the object exists. The fact that it points to NULL doesn't change that.

>>It depends too on exactly what he's testing for. If he really does just want to test for existence, then "AND NOT ISNULL(SomeObject)" might be an issue. An object can be null and still be an object. No?
>
>Of course!
>Exactly it is : "an unknown object reference"
>
>Various cases
>
>CLEAR
>
>someObject = _screen
>* someObject is a Known object reference, the object referenced is the SCREEN FORM
>? m.someObject,    VARTYPE(m.someObject),  VARTYPE(m.someObject,.T.), TYPE("m.someObject")
>*  Object                O                         O                         O
>
>* someObject = CAST(NULL AS Object) VFP don't support this ( a design bug )
>
>someObject = NULL
>* someObject is a unKnown object reference
>? m.someObject,    VARTYPE(m.someObject),  VARTYPE(m.someObject,.T.), TYPE("m.someObject")
>*  Object                X                         O                         O
>
>* another bug is
>someObject = CREATEOBJECT("cx")
>
>	someObject.RemoveObject("anotherObject")
>	
>	zombieObject = someObject.anotherObject
>	* zombieObject is an object reference
>	
>	? m.zombieObject ,    VARTYPE(m.zombieObject ),  VARTYPE(m.zombieObject ,.T.), TYPE("m.zombieObject ")
>	*  Object                O                         O                         O
>
>	* It is a Class member
>	on error ? message()
>	
>	REMOVEPROPERTY(someObject,"anotherObject")
>	
>	ON ERROR
>	
>	* But the Class have 0 members !
>	? "members count is", someObject.Objects.Count
>
>
>
>
>
>DEFINE CLASS cx AS Custom
>
>	ADD OBJECT anotherObject as Custom
>	
>ENDDEFINE
>
Previous
Reply
Map
View

Click here to load this message in the networking platform