Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class does not see its parent
Message
From
16/02/2011 10:16:07
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01500327
Message ID:
01500399
Views:
53
This message has been marked as a message which has helped to the initial question of the thread.
>>>>>>If the parents methods are not hidden or protected then you should be able to just this.oSomeObject.method() to see it. I don't think that this.oSomeObject would have a parent.
>>>>>>
>>>>>You misunderstood me. I need to invoke the main class method from oSomeObject class. I added a new property oParent to oSomeObject class and in the main class I did
>>>>>
>>>>>this.oSomeObject.oParent = this
>>>>>
>>>>>--------------
>>>>>I'm testing it right now, but it looks very dangerous to me. I also added this.oParent = null in the Destroy method of the oSomeObject class.
>>>>
>>>>If you need the object tree, why don't you use ,Add/.Newobject, which put the new object in the tree -
>>>>with backlink and no worry about hanging references when destroying ?
>>>>
>>>>puzzled
>>>>
>>>>thomas
>>>
>>>I'm now getting Property NEWOBJECT is not found. NEWOBJECT Error# 1734 Method:init Line: 569
>>>
>>>My class is defined as custom olepublic. Could it be a problem? (BTW, I already re-coded, so it would be funny to re-code back again).
>>>
>>>UPDATE. I take it back - the parent class is a session class. Does it mean I can not use NewObject method?
>>>
>>>UPDATE 2. Re-coded back again to use my original idea.
>>
>>A session is not a container class. You cannot add objects to it.
>>
>>You can pass its reference when you call functions of oSomeObject, ie
>>
>>=m.this.oSomeObject.SomeFunction(m.this)
>>
>
>I see. Hmm, should I re-code again now?
>
>Yes, this sounds like a simpler approach again and since I only needed it in one particular method so far, may be it's a way to go.
>
>Ok, what do you suggest - re-code the 4th time or leave what I have?

If you need access to the session object in only a couple of methods, I would pass the session's reference

As to recoding for the 4th time - that is your decision

If you need a session where you can use addobject(), you may use a toolbar or a form with a private datasession and not make it visible. This is what I used back in the vfp6 days

But I do not know whether that works with OlePublic
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform