Page 1 of 1

INVAssistant.ShowModal does not return nvmSkip

Posted: Thu Dec 17, 2020 9:33 am
by MasterDi
Hi, Madshi

Code: Select all

procedure Tfrm.mhException(const exceptIntf: IMEException;  var handled: Boolean);
var
  assistant: INVAssistant;
  mm: INVEdit;
  mr: TNVModalResult;
begin
  ...
  assistant:= exceptIntf.GetAssistant(exceptIntf.ShowAssistant);
  assistant.Forms[0].Message:= exceptIntf.ExceptMsg;
  mm:= assistant.Forms[0].nvEdit('memo');
  mm.Text:= exceptIntf.ExceptMessage;
  exceptIntf.EndUpdate;
  mr:= assistant.ShowModal(0);
  case mr 

For the user, I provide three choices.
but when he presses the button SkipBtn, the result is nvmOk, not nvmSkip.
Why is it so?

Re: INVAssistant.ShowModal does not return nvmSkip

Posted: Thu Dec 17, 2020 9:49 am
by madshi
Skipping only skips one page, not the whole assistant. Skipping means the user wants to skip one page but still wants to complete the assistant otherwise. So the INVAssistant.ShowModal returns nmvOk. However, INVForm.ShowModal should return nmvSkip, if the user presses the skip button. E.g. see here a code fragment (simplified a bit, for ease of understanding):

Code: Select all

function TNVAssistant.ShowModal(parentWindow: HWND = 0) : TNVModalResult;
var i1 : integer;
begin
  result := nvmOk;
  for i1 := 0 to high(FForms) do
    if FForms[i1].ShowModal(parentWindow) = nvmCancel then begin
      result := nvmCancel;
      break;
    end;
end;
So the behaviour is as intended.

E.g. imagine your assistant has 5 pages and the user only skips the 2nd page, but "ok"s all other 4 pages. Why would INVAssistant.ShowModal() then report nvmSkip? The user completed the assistant successfully, so the return value is nvmOk.

Re: INVAssistant.ShowModal does not return nvmSkip

Posted: Thu Dec 17, 2020 10:29 am
by MasterDi
Thank you, replaced by

Code: Select all

mr:= assistant.Forms[0].ShowModal(0);
and got nmvSkip.

But another question arose.
How can i display a window with error details in the same event (TMadExceptionHandler.OnException)?
exceptIntf.ShowBugReport(0);

Re: INVAssistant.ShowModal does not return nvmSkip

Posted: Thu Dec 17, 2020 10:34 am
by madshi
I don't understand your new question. Can you clarify what you mean exactly?

Re: INVAssistant.ShowModal does not return nvmSkip

Posted: Thu Dec 17, 2020 10:57 am
by MasterDi
If used ShowSetting = ssDetailBox, the details button (DetailsBtn) opens a form for viewing the log.

How do I open the same form, but in manual mode?

Code: Select all

procedure Tfrm.Exception(const exceptIntf: IMEException; var handled: Boolean);
begin
  case assistant.Forms[0].ShowModal(0)
    nvmCancel: 
      OpenDetailsForm ???

Re: INVAssistant.ShowModal does not return nvmSkip

Posted: Thu Dec 17, 2020 11:36 am
by madshi
I think "exceptIntf.Show()" is probably what you're looking for?

Edit: Not sure, maybe you have to set "exceptIntf.ShowSetting = ssFullBox" first?

Re: INVAssistant.ShowModal does not return nvmSkip

Posted: Thu Dec 17, 2020 12:24 pm
by MasterDi
.Show method shows a standard message (a form that corresponds to ssdetailbox)
But not a form with details (where the tabs are general, call stack ...)

is .ShowBugReport() responsible for this form?
But this method does not work.

Re: INVAssistant.ShowModal does not return nvmSkip

Posted: Thu Dec 17, 2020 12:25 pm
by madshi
Have you tried setting "exceptIntf.ShowSetting = ssFullBox" first?

Re: INVAssistant.ShowModal does not return nvmSkip

Posted: Thu Dec 17, 2020 12:35 pm
by MasterDi
Understood. It worked. Thanks

Code: Select all

procedure Tfrm.Exception(const exceptIntf: IMEException; var handled: Boolean);
begin
  if then
    exceptIntf.ShowSetting:= ssDetailBox
  else
  begin
    exceptIntf.ShowSetting:= ssFullBox;
    case assistant.Forms[0].ShowModal(0) of
      nvmCancel:
        exceptIntf.Show;