ENUMERATE( ) example
The following code uses ENUMERATE( ) to obtain an AssocArray filled with member names and types for an object reference. It then lists each member name, member type, member data type, and member value for each member of the object.
// Filename..: QuikList.PRG
// Parameters: oRef - Object reference to list.
// Usage.....: Set Procedure To My.WFM Additive
// ..........: f = New MyForm()
// ..........: Do QuikList With f
//
PARAMETERS oRef
PRIVATE cTemp, xTemp
LOCAL aa, cMember
Try
aa = Enumerate(oRef) // Enumerate the passed object
cMember = aa.FirstKey // Get first member name
Do While Not Empty(cMember)
? cMember // Display the member name
?? aa[cMember] At 30 // Display the member type
cTemp = "oRef." + cMember
xTemp = &cTemp. // Get the value of the member
?? Type("xTemp") At 33 // Display the data type
If xTemp # Null
?? Transform(xTemp, "@T") At 37 // Display the member value
EndIf
cMember = aa.NextKey(cMember) // Get next member name
EndDo
Catch(exception e)
MsgBox(e.Message, "QuikList") // Show any error that occurred
EndTry
// EOF: QuikList.PRG