ResetToDefault

This little builder will examine each selected object and compare it's current property values to the value it is inheriting from it's ParentClass definition. If the values are the same, i.e. overridden with the value it would be inheriting, the property is ResetToDefault. Please note there is a minor bug in the GETPEM() function which prevents it from detecting all of the same value overridden properties, for example it can not detect the PageFrame class Height and Width properties.

Either copy the text from the page or Click here to download reset.zip

* reset.prg 13-Jul-97

* Usage: select object(s) to be ResetToDefault
* in the command window enter reset()

* Copyright 1997, DF Software Development, Inc.

local i, j, n, m, laObjects[1]

n = aselobj( laObjects )  && all selected objects
if ( n = 0 )
   * nothing to do
   wait window "Select one or more controls to ResetToDefault" nowait
   return
endif

local j, m, lcClass, luObjectValue, luClassValue

for i = 1 to n
   m = amembers( laMembers, laObjects[i] )
   lcClass = laObjects[i].Class
   for j = 1 to m
      if (  pemstatus( laObjects[i], laMembers[j], 0 ) and ;
          ! pemstatus( laObjects[i], laMembers[j], 1 ) )
         * property is overridden and not read only, now check to see 
         * if it's the same as the default

         * NOTE: we have to pull these values out to a memvar, 
         *       getpem() inside an IF fails miserably.
         luObjectValue = getpem( laObjects[i], laMembers[j] )
         luClassValue  = getpem( lcClass,      laMembers[j] )
         if ( luObjectValue == luClassValue )
            * same as class, so reset it
            laObjects[i].ResetToDefault( laMembers[j] )
         endif
      endif
   endfor
endfor
1