开发者

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 bu开发者_开发百科g report (a copy of the users data files).

How can I check if the user checked the box?

regards, -Vegar


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


I don't know madExcept, but as far as it source code is Delphi (which seems from your tags), you can check it like this:

begin
  if CheckBox1.Checked then
    AttachDataFile;
end;

CheckBox1 is the name you set for the control when you dropped it into the forms editor. If you don't know the name, select it with the mouse and look at the object inspector for the property Name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜