NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
ng chee meng
Posts: 6
0 Kudos
Accepted Solution

Handling the runTimeErrorAction result from DisplayRunTimeErrorDialogEx

Hi,

 

I'm trying to replace the RunTime Error dialog with a customized dialog. The customized dialog will have the same options as the original dialog and some additional stuff. I attached an event handler to ApplicationMgr.BreakOnRunTimeError event but I don't know what's the correct way to mimic the behavior for the runTimeErrorAction.

 

I'm currently doing this:

 

var frameID = 0;
var sequenceContext = e.initiatingThread.GetSequenceContext(0, out frameID);

 

NationalInstruments.TestStand.Interop.API.RTEOptions.RTEOption_Continue:
  sequenceContext.SequenceErrorMessage = message;
  sequenceContext.SequenceErrorOccurred = true;
  sequenceContext.ErrorReported = true;
  sequenceContext.GotoCleanup = true;

  This makes the execution goes to cleanup and the sequence file will show Passed. The original behavior makes the execution shows Error.

 

NationalInstruments.TestStand.Interop.API.RTEOptions.RTEOption_Ignore:

  Do nothing

 

NationalInstruments.TestStand.Interop.API.RTEOptions.RTEOption_Retry:
  sequenceContext.NextStepIndex = sequenceContext.StepIndex;

  This has no effect.

 

NationalInstruments.TestStand.Interop.API.RTEOptions.RTEOption_Abort:
  e.exec.Abort();

  This is working fine.

 

Anyone can help with this?

Active Participant
dug9000
Posts: 1,509
0 Kudos

Re: Handling the runTimeErrorAction result from DisplayRunTimeErrorDialogEx

If you are handling the BreakOnRunTimeError event, you don't need to write the code to do these things, the ApplicationMgr does them for you. You just need to set the showDialog parameter to false so the ApplicationMgr won't show its dialog and set execution.RTEOptionForThisExecution to whichever option you want it to implement.

 

Hope this helps,

-Doug

Active Participant
dug9000
Posts: 1,509
0 Kudos

Re: Handling the runTimeErrorAction result from DisplayRunTimeErrorDialogEx

In looking at this more carefully, it appears that the BreakOnRunTimeError event does not work the way I thought it did (and probably not the way it was intended). Setting execution.RTEOptionForThisExecution has the side-effect of keeping the dialog from ever being displayed again. I've reported this issue for further consideration. To workaround this issue, the easiest thing you can do is to handle the AfterUIMessageEvent and reset RTEOptionForThisExecution back to RTEOption_ShowDialog, similar to the following:

 

        private void axApplicationMgr_AfterUIMessageEvent(object sender, NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_AfterUIMessageEventEvent e)
        {
            if (e.uiMsg.Event == UIMessageCodes.UIMsg_BreakOnRunTimeError)
            {
                e.uiMsg.Execution.RTEOptionForThisExecution = RTEOptions.RTEOption_ShowDialog;
            }
        }

Your BreakOnRunTimeError handler would look something like the following:

 

        private void axApplicationMgr_BreakOnRunTimeError(object sender, NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_BreakOnRunTimeErrorEvent e)
        {
            DisplayMyDialog(...);
            e.breakExecution = mydialogsbreakexecutionsetting;
            e.showDialog = false; // Don't show the application manager's dialog
            e.exec.RTEOptionForThisExecution = mydialogsrteoption;
        }

Hope this helps,

-Doug

Member
ng chee meng
Posts: 6
0 Kudos

Re: Handling the runTimeErrorAction result from DisplayRunTimeErrorDialogEx

It's working. Thanks :smileyhappy:

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page