Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BindEvents bug
Message
From
31/12/2004 14:44:28
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00973564
Message ID:
00973569
Views:
13
Read message 971680

>I get different results when running the following program under VFP 8 and 9.
>
>The program uses the combination of a global accessor and BINDEVENT to create an object proxying system where one object can stand in for another.
>
>Under VFP 8 and the VFP 9 Beta, the program executes correctly. I get the expected result of the instance of the Imposter class posing as RealObject.
>
>Under the release version of VFP 9, the code breaks. The BINDEVENT function is disregarding the delegate return value and using the Event return value instead.
>
>
>LOCAL loImposter, loRealObject
>
>loImposter = CREATEOBJECT("Imposter")
>loRealObject = CREATEOBJECT("RealObject")
>
>loImposter.PoseAs(loRealObject)
>
>?loImposter.Name
>?loImposter.Class
>?loImposter.HelloWorld()
>
>RETURN
>
>DEFINE CLASS Imposter AS CUSTOM
>
>  PROCEDURE Self
>    RETURN THIS
>  ENDPROC
>
>  PROCEDURE PoseAs
>    LPARAMETERS toClient
>    *-- If you use an nFlags value of 1, the value returned by a
>    *-- method call to the event is not that of the event,
>    *-- but rather that of the last delegate invoked.
>    BINDEVENT(THIS, "self", toClient, "self", 1)
>  ENDPROC
>
>  PROCEDURE THIS_ACCESS
>    LPARAMETERS tcPEMName
>    LOCAL loHandler
>    IF tcPEMName == "self" OR tcPEMName == "poseas"
>      loHandler = THIS
>    ELSE
>      loHandler = THIS.Self()
>    ENDIF
>    RETURN loHandler
>  ENDPROC
>
>ENDDEFINE
>
>DEFINE CLASS RealObject AS CUSTOM
>
>  PROCEDURE Self
>    RETURN THIS
>  ENDPROC
>
>  PROCEDURE HelloWorld
>    RETURN "Hello World!"
>  ENDPROC
>
>ENDDEFINE
>
- Jeff
Previous
Reply
Map
View

Click here to load this message in the networking platform