INVAssistant.ShowModal does not return nvmSkip

delphi package - automated exception handling
Post Reply
MasterDi
Posts: 7
Joined: Thu Dec 17, 2020 9:24 am

INVAssistant.ShowModal does not return nvmSkip

Post 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?
madshi
Site Admin
Posts: 10328
Joined: Sun Mar 21, 2004 5:25 pm

Re: INVAssistant.ShowModal does not return nvmSkip

Post 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.
MasterDi
Posts: 7
Joined: Thu Dec 17, 2020 9:24 am

Re: INVAssistant.ShowModal does not return nvmSkip

Post 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);
madshi
Site Admin
Posts: 10328
Joined: Sun Mar 21, 2004 5:25 pm

Re: INVAssistant.ShowModal does not return nvmSkip

Post by madshi »

I don't understand your new question. Can you clarify what you mean exactly?
MasterDi
Posts: 7
Joined: Thu Dec 17, 2020 9:24 am

Re: INVAssistant.ShowModal does not return nvmSkip

Post 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 ???
madshi
Site Admin
Posts: 10328
Joined: Sun Mar 21, 2004 5:25 pm

Re: INVAssistant.ShowModal does not return nvmSkip

Post 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?
MasterDi
Posts: 7
Joined: Thu Dec 17, 2020 9:24 am

Re: INVAssistant.ShowModal does not return nvmSkip

Post 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.
madshi
Site Admin
Posts: 10328
Joined: Sun Mar 21, 2004 5:25 pm

Re: INVAssistant.ShowModal does not return nvmSkip

Post by madshi »

Have you tried setting "exceptIntf.ShowSetting = ssFullBox" first?
MasterDi
Posts: 7
Joined: Thu Dec 17, 2020 9:24 am

Re: INVAssistant.ShowModal does not return nvmSkip

Post 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;
Post Reply