Hi Agnes,
That's strange because this works fine in VFP8 and previous versions.
I think a lot of people will start having errors due to this bug.
It must be a VFP9 bug because the helpfile you quote states the same for all versions of foxpro.
What about people (as we) who use Business object classes based on dataclasses?
Guillaume
>Guillaume,
>
>As far as I know (and use):
>
>from VFP Help NEWOBJECT:
>
>If cModule is
omitted, or is the empty string or the null value, Visual FoxPro searches for the class or object in the following order: Visual FoxPro base classes.
>-Classes in the current program.
>-Class libraries opened with SET CLASSLIB.
>-Classes in procedure files opened with SET PROCEDURE.
>-Classes in the Visual FoxPro program execution chain.
>-The OLE registry if SET OLEOBJECT is ON.
>
>The
omitted is wrong. It works always that way. IOW yu can not call a class down the chain that exists somewhere beyond. It should be better
>
>-Classes in the current program.
>-Class libraries opened with SET CLASSLIB.
>-Classes in procedure files opened with SET PROCEDURE.
>-Classes in the Visual FoxPro program execution chain.
>-The OLE registry if SET OLEOBJECT is ON.
>-cModule
>
>
>>Hi, We launched this already on the buglist, but since there's still not a singel reaction, we cannot but wonder how nobody else experiences this problem.
>>Here goes :
>>
>>If you create a newobject() in a prg class in a method
>>which calls a class with the same name but in another prg, the original class is instantiated again.
>>Steps to reproduce
>>
>>Make a first prg called Vfp9Obj1.fxp
>>
>>LOCAL loTryThis
>>loTryThis = NEWOBJECT("Bobtest","Vfp9Obj1.fxp")
>>SET STEP ON
>>loTryThis.DoSomething()
>>
>>DEFINE CLASS Bobtest as session
>>
>> procedure Init
>> ENDPROC
>>
>> PROCEDURE DoSomething()
>> LOCAL loTest
>> loTest = NEWOBJECT("BobTest","Vfp9Obj2.fxp")
>> loTest.DoSomething()
>> ENDPROC
>>ENDDEFINE
>>
>>
>>Make the second class in fxp called Vfp9Obj2.fxp
>>
>>
>>DEFINE CLASS Bobtest as session
>>
>> procedure Init
>> ENDPROC
>>
>> PROCEDURE DoSomething()
>> WAIT WINDOW "test"
>> ENDPROC
>>ENDDEFINE
>>
>>
>>Observed results
>>
>>If you RUN the first prg, and step into the loTest.DoSomething(),
>>you are redirected to the same DoSomething method instead of the new class
>>
>>Expected results
>>
>>The NewObject should use the Fxp parameter to instantiate the correct class