title: Delphi getting value of form components properties
body: <p>I am implementing a Boilerplate  feature - allow users to Change descriptions of some components - like  <code>TLabel</code>s - at run time.
  e.g.</p>
  
  <pre><code>TFooClass = Class ( TBaseClass)
   Label : Tlabel;
   ...
   End;
  
   Var FooClass : TFooClass;
  </code></pre>
  
  <p>...</p>
  
  <p>At design time, the value Label's caption property is say - 'First Name', when the 
  application is run, there is a feature that allows the user to change the caption 
  value to say 'Other Name'. Once this is changed, the caption for the label for
  the class instance of FooClass is updated immediately.</p>
  
  <p>The problem now is if the user for whatever reason wants to revert back to the design
  time value of say 'First Name' , it seems impossible.</p>
  
  <p>I can use the RTTIContext methods and all that but I at the end of the day, it seems
  to require the instance of the  class for me to change the value and since this 
  has already being changed - I seem to to have hit a brick wall getting around it.</p>
  
  <p>My question is this - is there a way using the old RTTI methods or the new RTTIContext
  stuff to the property of a class' member without instantiating the class - i.e. getting
  the property from the ClassType definition.</p>
  
  <p>This is code snippet of my attempt at doing that :</p>
  
  <pre><code>  c : TRttiContext;
     z : TRttiInstanceType;
     w : TRttiProperty;
   Aform : Tform;
    ....
   Begin
   .....
  
     Aform := Tform(FooClass);
  
     for vCount := 0 to AForm.ComponentCount-1 do begin
      vDummyComponent := AForm.Components[vCount];
      if IsPublishedProp(vDummyComponent,'Caption') then begin
        c := TRttiContext.Create;
         try
           z := (c.GetType(vDummyComponent.ClassInfo) as TRttiInstanceType);
           w := z.GetProperty('Caption');
            if w &lt;&gt; nil  then
               Values[vOffset, 1] := w.GetValue(vDummyComponent.ClassType).AsString
          .....
          .....
  
  ....
  ....
  </code></pre>
  
  <p>I am getting all sorts of errors and any help will be greatly appreciated.</p>