Wiki Home

Nd Pems


Namespace: Wiki
Grabs the non default PEMS of an object.

#DEFINE CRLF CHR(13)+CHR(10)

local laObjs(1)

* Put your favorite class here
modify class test of test nowait

aSelObj( laObjs, 1 )

_cliptext = GetND( laObjs(1), 0 )

return




function GetND( toObject, tnLevel )

* returns a string of Non-Default PEMs and values

local ;
   laPems(1), lnPems, lnPem, lcPem, lcPemTyp ;
   lcPemLst, ;
   luPrpVal, ;
   luPntPrpVal, ;
   lcPrpVal, ;
   lcObjDsc

lcPemLst = ""

* Get a list of the members of the passed object
lnPems = aMembers( laPems, toObject, 1 )

for lnPem = 1 to lnPems
   * The current PEM and type
   lcPem = laPems( lnPem, 1 )
   lcPemTyp = laPems( lnPem, 2 )

   do case
	
   case lcPemTyp = "Property"
      * If the property is an array... (finish when needed)
      if type( "ALEN(toObject." + lcPem + ")" ) = "N"
         *lcPemLst = lcPemLst + space( tnLevel*2 ) + lcPem + "()..." + CRLF
      else									
         * If the Property's value overrides the ParentClass, add it to the list.
         if PEMStatus( toObject, lcPem, 0 )
            luPrpVal = getPEM( toObject, lcPem )
            lcPrpVal = transform( luPrpVal )
            lcPemLst = lcPemLst + space( tnLevel*2 ) + ;
                  lcPem + " = " + lcPrpVal + CRLF
         endif
      endif
			
   case inlist( lcPemTyp, "Event",  "Method" )
      * If there is code in the method, just note it.
      if !empty( GetPEM( toObject, lcPem ) )
         lcPemLst = lcPemLst + ;
            space( tnLevel*2 ) + lcPem + " (Non Default Method)" + CRLF
      endif

   case lcPemTyp = "Object"
      * Recursively call getNt, bump the indent level
      lcObjDsc = getNd( eval( "toObject." + lcPem ), tnLevel + 1 )
      * If there are some overrides, add to the list
      if !empty( lcObjDsc )
         lcPemLst = lcPemLst + space( tnLevel*2 ) + lcPem + CRLF + lcObjDsc
      endif
   endcase
	
endfor

return lcPemLst

Contributors: Carl Karsten
Category Code Samples