Page 1 of 1

callback for LastMantisIssueId after bugreport send

Posted: Tue Feb 27, 2018 10:36 am
by nemopeti
Hello,

How can I got the LastMantisIssueId value, after the user clicked the send button on the madExcept dialog.
I neet to show the send bug ID back to the user in a message box.

I try to find a callback like 'AfterBugReportSend' or something, but I can't find.

Re: callback for LastMantisIssueId after bugreport send

Posted: Tue Feb 27, 2018 4:24 pm
by madshi
You can use RegisterExceptActionHandler. See here:

Code: Select all

type
  // enumeration for the exception action events
  TExceptAction = (eaSendBugReport,  eaSaveBugReport,  eaPrintBugReport,   // before assistant
                   eaSendBugReport2, eaSaveBugReport2, eaPrintBugReport2,  // after assistant
                   eaSendBugReport3, eaSaveBugReport3, eaPrintBugReport3,  // after sending/saving/printing
                   eaShowBugReport,
                   eaHelp,
                   eaContinueApplication, eaRestartApplication, eaCloseApplication);

Re: callback for LastMantisIssueId after bugreport send

Posted: Wed Feb 28, 2018 1:32 pm
by nemopeti
ok, now I can catch the event, but, how can I access the LastMantisIssueId varible content?

Re: callback for LastMantisIssueId after bugreport send

Posted: Wed Feb 28, 2018 1:33 pm
by madshi
Simply add "madExcept" to the uses clause, then you can access "LastMantisIssueId" directly.

Re: callback for LastMantisIssueId after bugreport send

Posted: Wed Feb 28, 2018 1:57 pm
by nemopeti
wow, almost perfect, just one more thing.
How can I close the madexcept dialog, from code.

the flow, I like to make:

exception occures -> madexcept dialog shown -> user clicked the send report button -> after the report successfuly send close madexcept dialog adn showmessage the bug ID

Re: callback for LastMantisIssueId after bugreport send

Posted: Wed Feb 28, 2018 2:03 pm
by madshi
You can use madExcept.GetExceptBoxHandle() to get the win32 "HWND" handle of the exception box. I suppose you could try posting WM_CLOSE to it. Not sure if that would work. Alternatively you could use FindWindowEx() to browse through the child windows to get the handle of the "continue application" button and send a message to it to "press" the button.

Please make sure that the GUI you're using to show the Mantis ID is thread safe. The VCL is not thread safe. You could use the win32 API "MessageBox()". Make sure it's "Windows.MessageBox()", just to be safe it's not some VCL variant.

Re: callback for LastMantisIssueId after bugreport send

Posted: Wed Feb 28, 2018 2:18 pm
by nemopeti
seems perfect, extra thenks for the threadsafe tip!