title: Copy a TPanel and all of it's Controls at runtime
body: <p>Delphi-version5.
  I have a file comparison app I am putting together and it has a Left and Right Panel on the main form. Each panel (pnlLeft and pnlRight) has an identical range of Controls and events only separated by name. i.e btnCheckLeft(... and btnCheckRight(... and I am having problems keeping the code changes synched between the two Panels.</p>
  
  <p>I am wondering if I can make a single Panel (on a separate Form) with all of the controls and events and then at runtime, copy it twice, once for the pnlLeft an the other, the pnlRight to the main form. On that single Form, I can manage the coding just the once instead of trying to duplicate everything.</p>
  
  <p>During the process, set the Align and the Event names to apply to each copy as in...</p>
  
  <p>The first copy to the blank main form...</p>
  
  <pre><code>pnlLeft.Align:=alLeft;
  pnlLeft.Button1Click(Sender)...
  </code></pre>
  
  <p>the second copy</p>
  
  <pre><code>pnlRight.Align:=alLeft;
  pnlRight.Button1Click(Sender)...
  </code></pre>
  
  <p>How or is that possible? I think I need a Component of the full Panel, but I am not skilled enough to create a Component of this complexity yet.</p>
  
  <p>I checked this 
  <a href="https://stackoverflow.com/questions/5462866/how-to-copy-all-the-tlabels-parented-with-a-tpanel-on-delphi-to-another-tpanel">how to copy all the TLabels parented with a TPanel on delphi to another TPanel?</a></p>
  
  <p>and this 
  <a href="https://stackoverflow.com/questions/239002/duplicating-components-at-run-time">Duplicating components at Run-Time</a></p>
  
  <p>but don't think either will do what I need.</p>
  
  <p>Thanks for anything you can help with.</p>