General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only