LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to make run time error in a callback

Hi,
 
Assuming a main rountine execute RunUserInterface.
 
How to make a run time error in one of the Interface callback routines?
 
Thanks
Rafi
0 Kudos
Message 1 of 5
(3,100 Views)

If this is for your own validation, then you can pop up an error dialog. Something like MessagePopup() for example would work.

Bilal Durrani
NI
0 Kudos
Message 2 of 5
(3,102 Views)
If your problem is how to catch runtime errors, correctly react to them and warn the operator, you may look at errChk and nullChk macros: they are defined in toolbox.h and extensively used in the Programmer's Toolbox that comes with CVI.
To make these macros more useful and general use, I made some additions to them and developed another set of macros which are described in this thread: inside it there is also a small routine that uses a MessagePopup to warn the operator of the problem occurred as Bilal suggested.
Remember that your routine will be blocked waiting for input when the popup message is shown, so I reccommend you emit the popup after the proper countermeasures are taken to correct the error.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 5
(3,092 Views)
Thanks Roberto and Billal,
 
I can see how I jump to an error routing and print messages.  However, I'm aiming more towards a situation where the program is running under TestStand.  Usually I know how to create a run-time error so that TS displays a runtime error with some information. 
 
In this particular case, I'm referring to a situation were CVI is running a window (for barcode input in this case...) and is executing callbacks.  How do I return the error back to TS and terminate the program?
 
Thanks
Rafi
0 Kudos
Message 4 of 5
(3,072 Views)

Rafi,

You can perform the Execution.Terminate() method or Engine.TerminateAll(),

Use the TestError parameter to return any error back into your TestStand Step.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 5 of 5
(3,059 Views)