Basically, I want to have a field inside an object, that optionally points to another object. If the object that is being pointed to is null, I need to be able to respond to that in code. In this example code, I set up 2 objects, they have the same fields. ObjectB points to ObjectA via one of the fields, however when ObjectA becomes nullified, I can't find a way to verify that in code? Thanks for any insight you can offer. ;)
Type testobj Field x:Int Field obj:testobj End Type ' Global mylist:TList = New TList ' Global objA:testobj = New testobj objA.x=Rand(100,800) ListAddLast(mylist,obja) ' Global objB:testobj = New testobj objB.x=Rand(100,800) objB.obj = objA ' add a reference to obja ListAddLast(mylist,objb) ' Print "Items in list:" + CountList(mylist) ' ListRemove(mylist,objA) ' remove item from list ' Print "Items in list:" + CountList(mylist) ' Print "After removing object A from the list..." ' If objA = Null Print "object A is null" Else Print "object A is still alive" EndIf ' objA = Null ' Print "After setting object A to null..." ' If objA = Null Print "object A is null" Else Print "object A is still alive" EndIf ' ' I need to find out if objB.obj is pointing to a null object! ' ' Try 1....? If objB.obj = Null Print "object B reference to A is null" Else Print "object B reference to A is NOT null" EndIf ' Try 2....? If testobj(objB.obj) = Null Print "obeject B reference to A is null" Else Print "object B reference to A is NOT null" EndIf