Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bug? Calling methods in object returned by access method
Message
De
27/02/2003 07:42:09
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00755131
Message ID:
00758675
Vues:
17
Armin,

Sorry to be late in this discussion, but I had the same problem in VFP7 with my collection class. The returning of the object references were inconsistent with slower machines running Win98, but also produced an odd behavior with fast boxes running Win2k.

For example:
llAllowDelete = This.oCursor("myView").oBizRule("AllowDelete") worked most of the time

loCursor = This.oCursor("myView")
llAllowDelete = loCursor.oBizRule("AllowDelete") worked all of the time

One of the strangest side effects was that the .exe would never shutdown properly - it would remain as a process in the task manager even if there was no runtime error. Took me over a week to track that bug. Once I split it into oCursor, everything worked fine.

I seem to recall a problem with access methods returning object references in VFP5. I think it was fixed for the most part, but maybe not entirely.

>Hi,
>
>I ran into this some minutes ago ... Could someone please verify this behaviour? Or is this already a known issue? If not, I would directly submit it to MS.
>
>Thanks,
>Armin
>
>
>
>*--------------------------------------------------------------
>*--
>*-- Visual FoxPro 08.00.0000.2521 for Windows
>*--
>*-- Works fine in Visual FoxPro 07.00.0000.9465 for Windows
>*-- Works fine in Visual FoxPro 08.00.0000.2021 for Windows
>*--
>*-- Demonstrates possible access method bug when directly
>*-- calling a method in the returned object like so:
>*--
>*-- THIS.uProp(1).Add("1")
>*--
>*-- The access method gets .F. instead of 1 as it's
>*-- parameter value. For workarounds see below.
>*--
>*-- Submitted by armin.neudert@ansta.de
>*-- 02-19-2003 08:50 pm
>*--
>*--------------------------------------------------------------
>
>LOCAL loX
>loX = CREATEOBJECT("test")
>loX.Test()
>
>
>DEFINE CLASS test AS Session
>
>	oCollection = .NULL.
>	
>	DIMENSION uProp[1]
>	uProp[1] = .F.
>
>	PROCEDURE Init
>
>		THIS.oCollection = CREATEOBJECT("TestCollection")
>
>	ENDPROC
>
>
>	PROCEDURE Test
>		
>		*-- Used to work in the public beta and in previous versions
>		*-- VFP passes .F. instead of 1 as index parameter to the
>		*-- access method.
>		THIS.uProp(1).Add("1")
>
>		*-- This way it works!
>		LOCAL loTest
>		loTest = THIS.uProp(1)
>		loTest.Add("2")
>
>		*-- This way it works, too!
>		? THIS.uProp(1).Add("3")
>
>		*-- This way it works, too!
>		LOCAL luDummy
>		luDummy = THIS.uProp(1).Add("4")
>
>	ENDPROC
>
>	PROCEDURE uProp_Access
>		LPARAMETERS tlnIndex
>
>		MESSAGEBOX( "Index passed to uProp_Access: " + TRANSFORM(tlnIndex) )
>		
>		RETURN THIS.oCollection
>	
>	ENDPROC
>
>ENDDEFINE
>
>
>
>DEFINE CLASS TestCollection AS Session
>
>	PROCEDURE Add
>		LPARAMETERS tluDummy
>		
>		*-- Just a dummy method
>		
>	ENDPROC
>
>ENDDEFINE
>
- Jeff
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform