09-15-2009 03:15 AM - edited 09-15-2009 03:17 AM
Hi all,
i'm creating a custom OI and i would like to handle the EndExecution event in an event case structure, exactly in the same way as the ExitApplication event is handled in the Simple OI example.
I succeeded creating the callback VI but i don't know how to register the event in order to manage it in an event case.
In the attached image you can see related block diagram.
Hope someone could help me!
09-16-2009 07:31 AM
09-16-2009 10:18 AM
Ciao aRCo,
I started from the UI distributed with TestStand (National Instrumenys->TestStand->User Interfaces->LabVIEW->Source code) and made some changes to add the end of execution event.
I'm attaching some screenshot of how I succeded in this operation.
My callback VI simply opens a pop up after the execution of a sequence file.
Hope this can help.
Ciao,
Andrea
09-17-2009 02:37 AM
So simple?!? Thus the only thing i have to do is to put some code into the callback VI that i've already created... Woooowww!
And what about error handling? Can i treat the callback VI as a normal VI and put into it an ErrorIn and an ErrorOut cluster in order to handle errors?
09-19-2009 09:31 AM
No you cannot treat error in and error out in the callack VI because if you change the prototype of the VI (the connector pane) by adding th error in and error out terminals you will get an error and the VI won't be a callback VI any more.
So what you have to do is to create a user event and fire the error event inside the callback VI. This event will be then managed by an event structure that you'll put in the main VI.
You can take a look at this example about creating user events:
http://decibel.ni.com/content/docs/DOC-5404
Your VI will be a little bit different because the data type of the event is the error cluster, and then you will fire the event in the callback VI and manage it in the Main VI. You will need to pass the user event reference to the callback VI as a parameter and then you're all set.
Have a good week end,
Andrea