title: Generic dialog with custom captions for buttons
body: <p>I know this issue have been up since before (ex. <a href="https://stackoverflow.com/questions/1100073/what-is-the-best-way-in-delphi-to-show-customized-message-dialogs">Best way to show customized message dialogs</a>), but I still don't find what I want.</p>
  
  <p>I started like this:</p>
  
  <pre><code>class function TAttracsForm.MessageDlg(const aMsg: string; aDlgType: TMsgDlgType; Buttons: TMsgDlgButtons; aCaptions: array of String; aDefault: TMsgDlgBtn): TModalResult;
  var
    vDlg: TForm;
    i: Integer; 
  begin
    if aButtons.Count = aCaptions.Count then
    begin
      vDlg := CreateMessageDialog(aMsg, aDlgType, Buttons);
      try
        for i := 0 aCaptions.Count - 1 do
          TButton(vDlg.FindComponent(Buttons[i].Caption)).Caption := aCaptions[i]; 
  
        vDlg.Position := poDefaultPosOnly;
        Result := vDlg.ShowModal;
      finally
        vDlg.Free;
      end;
    end;
  end;
  </code></pre>
  
  <p>And the call would look like:</p>
  
  <pre><code>if (MessageDlg('Really quit application ?', mtWarning, 
         [mbNo, mbCancel, mbYes], {'No save', 'Cancel', 'Save'}) = mrYes) then
  </code></pre>
  
  <p>But the above code of course don't compile. I don't know how to get one item of an set in the loop and how to get the total count of it in the beginning.</p>