Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug? Calling methods in object returned by access methods
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Bug? Calling methods in object returned by access methods
Miscellaneous
Thread ID:
00755131
Message ID:
00755131
Views:
50
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

Armin Neudert
Regional Director (Stuttgart) of German FoxPro User Group dFPUG

MCP for Visual FoxPro

Expert/Editor of the VFP section in the German Codezone community portal
Next
Reply
Map
View

Click here to load this message in the networking platform