Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Array of Objects
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Array of Objects
Miscellaneous
Thread ID:
00260373
Message ID:
00260373
Views:
45
I have an array that contains Object references to fields on a form that can be resized. The array contains an object reference to the field, original object Height, Width , Left, Top, Etc. If I add an object during runtime using the ADDOBJECT it immediately runs the Init of the object which adds this object to the array. I then change some of the objects properties and I need to change the array's initial settings.

How do I scan an array that has an object reference for the passed object reference?

The array is located on the form as 'thisform.aRegisteredObjects'.

Example of Code:
ADDOBJECT('txtMonth01', 'mylabel')
WITH txtMonth01
.CAPTION = MonthCaption
.HEIGHT = 15
.LEFT = 57
.TOP = 56
.WIDTH = 53
.VISIBLE = .T.
THISFORM.RegisterResize(THIS)
ENDWITH

Function RegisterResize
LPARAMETERS oRegObject
LOCAL lnRegisteredObjectCounter, lnPos
*-- The object is being Re-Register in the array
*-- Locate the object in the array
SET CLASSLIB TO utility ADDITIVE && VFP Library
oUtility = CREATEOBJECT("Utility.Arraylib")
lnPos = oUtility.AColScan(thisform.aRegisteredObjects, oRegObject, 1, .F.)
oUtility = .null.
Release CLASSLIB utility
IF lnPos != 0
*-- Object is found, therefore we can Re-Register the object values
lnRegisteredObjectCounter = ASUBSCRIPT(this.aRegisteredObjects, lnPos, 1)
ENDIF
....
EndFunction
Next
Reply
Map
View

Click here to load this message in the networking platform