10-19-2021 11:48 AM
I'm Craeting a Hardware Interface API and providing my customer easy tools to use LabVIEW. Note that my customer is not an expert in LabVIEW and they tend to use Express VIs and Abort Buttons frequently.
I'm making my own express VI using the Hardware API and it works fine for me. I need to know if there is any way that I can detect that the top level Aplication program (made by the customer) is aborted by pressing the abort button, so that I can close my device referance gracefully, and it opens properly next time. (presently If I press abort, I need to unplug the device before using next time).
I checked this -
How to detect Front Panel ToolBar Abort Button? - NI Community
But not much help.
I tried to explain techanicality to my customer, but the counter argument I got is that the same behaviour works with NI DAQ. If we abort, it will still work properly next time.
Any help will be appreciated.
10-19-2021 12:43 PM - edited 10-19-2021 12:47 PM
@meBaga wrote:
I'm Craeting a Hardware Interface API and providing my customer easy tools to use LabVIEW. Note that my customer is not an expert in LabVIEW and they tend to use Express VIs and Abort Buttons frequently.
I'm making my own express VI using the Hardware API and it works fine for me. I need to know if there is any way that I can detect that the top level Aplication program (made by the customer) is aborted by pressing the abort button, so that I can close my device referance gracefully, and it opens properly next time. (presently If I press abort, I need to unplug the device before using next time).
I checked this -
How to detect Front Panel ToolBar Abort Button? - NI Community
But not much help.
I tried to explain techanicality to my customer, but the counter argument I got is that the same behaviour works with NI DAQ. If we abort, it will still work properly next time.
Any help will be appreciated.
Counter that by saying that using the abort button is a highly discouraged LabVIEW practice and you will not cannot provide support for your software if this is a requirement.
10-19-2021 12:46 PM - edited 10-19-2021 12:59 PM
If you can't persuade them from not doing the thing that's bad for them...
(As mentioned in the linked thread, you can remove the Abort button from the toolbar and provide them a safer way to stop).
-Kevin P
10-19-2021 01:10 PM
@Kevin_Price wrote:
If you can't persuade them from not doing the thing that's bad for them...
(As mentioned in the linked thread, you can remove the Abort button from the toolbar and provide them a safer way to stop).
-Kevin P
This would not solve his problem because I believe he is supplying a library and the client is in control of the top level VI.
You could always tell your customer that using the abort button is the same thing as stopping your car by running into a brick wall. It works, but the outcome is certainly not desirable.
10-19-2021 01:27 PM
AFAIK there is no way to do what you're asking. Which is why everyone is trying to convince you, to convince your customer, to not click the abort button.
What would even detect the abort button click if everything stops when you press it?
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
10-19-2021 01:53 PM
@meBaga wrote:
I tried to explain techanicality to my customer, but the counter argument I got is that the same behaviour works with NI DAQ. If we abort, it will still work properly next time.
Any help will be appreciated.
Try explaining it this way...
You are a passenger in a car traveling 60 MPH and you tell the driver to stop.
Pressing the Stop button:
Pressing the Abort button:
What car would you rather be riding in?
Honestly I don't think there is much you can do. Except try to implore them that they should not be running in the development environment anyway. If they were running a compiled executable you could hide the abort button and catch the "panel close" event and do a proper shutdown if they just closed the program.
10-19-2021 02:10 PM
@RTSLVU wrote:
Except try to implore them that they should not be running in the development environment anyway.
This is the real question that needs answered. Why are they running this in the Development Environment and not a exeuteable? Or does the EXE have the Abort button being shown?
10-19-2021 02:27 PM
@Mark_Yedinak wrote:
@Kevin_Price wrote:
If you can't persuade them from not doing the thing that's bad for them...
(As mentioned in the linked thread, you can remove the Abort button from the toolbar and provide them a safer way to stop).
-Kevin P
This would not solve his problem because I believe he is supplying a library and the client is in control of the top level VI.
You could always tell your customer that using the abort button is the same thing as stopping your car by running into a brick wall. It works, but the outcome is certainly not desirable.
You could obtain a reference to their vi and take the abort button off of their tool bar. A bit malicious but it forces them to not use the abort button. I'm not sure that it would fix your problem, though, as they would likely just program in a new abort button.
On a more serious note, could you make your application run asynchronously and check when the caller vi stops running? The vi that you make open for them to call would just be a wrapper to call and forget your asynchronous vi. You could give your asynchronous vi a reference to the calling wrapper, and let the wrapper run until they abort. It would be easy enough to provide functionality for proper shutdown later. It's not ideal (would be better if they would follow reasonable programming practices), but it might be a workaround.
10-19-2021 06:28 PM
@Eric1977 wrote:
@RTSLVU wrote:
Except try to implore them that they should not be running in the development environment anyway.
This is the real question that needs answered. Why are they running this in the Development Environment and not a exeuteable? Or does the EXE have the Abort button being shown?
Anecdotally, in its early years, LabVIEW didn't have the option of creating an executable.
10-19-2021 07:07 PM
@billko wrote:
@Eric1977 wrote:
@RTSLVU wrote:
Except try to implore them that they should not be running in the development environment anyway.
This is the real question that needs answered. Why are they running this in the Development Environment and not a exeuteable? Or does the EXE have the Abort button being shown?
Anecdotally, in its early years, LabVIEW didn't have the option of creating an executable.
And I had to install it from floppy disks. I remember prompts like "Please insert disk 15 or 20". Those were the days. Can't forget no undo either.