Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strange Collection Class Problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Strange Collection Class Problem
Divers
Thread ID:
01250288
Message ID:
01250288
Vues:
59
I am using a collection to hold ImageParams objects. The ImageParams object is a custom class with 12 properties added that contain info about the image. The images are stored in a SQL database, pulled into a VFP cursor, then the data from the cursor is then loaded onto the ImageParam class's properties. The Image class is then added the collection as in the code below.

The problem is that each item in the collection is overwriting all other items in the collection.

I have also tried storing the Param objects in an array, with the same result.

See this code, then the 2 pics below the code:
** Get the image data
oApplication.oDBInterface.GetCursor(.sQuery, "TempImages")

IF RECCOUNT("TempImages") > 0

	** Loop once for each record
	SELECT TempImages
	SCAN
	
		** Get an instance of the image parameter class off the app object
		oParams = oApplication.oImageParams
		
		** Store the record's data to the object
		WITH oParams
		
			.iGraphicType 	= TempImages.GraphicType	
			.sCode 		= LOWER(ALLTRIM(TempImages.Code))
			.iSize 		= TempImages.Size
			.iFileType 	= TempImages.FileType
			.iState 	= TempImages.State
			.iLocation 	= TempImages.Location
			.iBorderColor 	= TempImages.BorderColor
			.iShape 	= TempImages.Shape
			.iColor 	= TempImages.Color
			.sOther 	= TempImages.Other
			.sStruct	= This._sStruct			
			.sImageBinary 	= TempImages.ImageFile
		
		ENDWITH	

		** Determine the path
		IF oParams.iGraphicType = GRAPHIC_TYPE_MENU
			sPath = oApplication.oSettings.sGraphicsPath
		ELSE
			sPath = oApplication.oSettings.sIconPath
		ENDIF

		** Create the file in the temp location, storing the file name 
		** to the image object
		oParams.sFileName = .GetImageFile(oParams, sPath)
	
		** Add the item to the collection
		.Add(oParams)

	ENDSCAN

ENDIF
http://marois-consulting.com/ut/collection1.jpg
http://marois-consulting.com/ut/collection2.jpg
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform