Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test If a Variable exists
Message
From
02/09/2006 03:34:55
 
 
To
01/09/2006 09:33:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01150290
Message ID:
01150487
Views:
31
This message has been marked as the solution to the initial question of the thread.
>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
Next
Reply
Map
View

Click here to load this message in the networking platform