delphimadexcept

madExcept, checking state of checkbox in custom assistant before attaching additional files to the report


I have modified the send-assistant of madExcept with a new checkbox. If the use checks this box, I want to send additional attachments with the bug report (a copy of the users data files).

How can I check if the user checked the box?

regards, -Vegar


Solution

  • I have solved this issue with help from madshi over at forum.madshi.net.

    My solution involves the TMadExceptionHandler-component, and the event OnExceptionAction.

    procedure TMainForm.MadExceptionHandler1ExceptAction(action: TExceptAction; 
      const exceptIntf: IMEException; var handled: Boolean);
    var
      cbSendData: INVCheckbox;
      assistant: INVAssistant;
    begin
      if action = eaSendBugReport2 then
      begin
        assistant := exceptIntf.GetAssistant(exceptIntf.SendAssistant);
        cbSendData := assistant.Forms[1].nvCheckBox('SendDataChk');
    
        exceptIntf.AdditionalAttachments.Clear;
        if (cbSendData.Checked) then
        begin
          //Add data files as attachments...
        end;
      end;
    end;
    

    One minor thing remains, and that is to enable/disable the checkbox on special occasions. Madshi tells me the proper way of doing that, is to register an actionhandler-callback with the assistant and check for an nvaItemEvent-action on the checkbox. I have not tried this yet.

    -Vegar