08-30-2023 11:50 AM
Hi,
I'm making a data acquisition program which first prompts the user to select their desired cDAQ chassis, via a custom dialog box. I created this dialog box by following the tutorial here: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2BiCAI&l=en-US
My custom dialog box functions the way I want, in that the user can select their cDAQ chassis, press "OK", and continue with the program. Or, the user may press "Cancel" and the program is aborted. However, I've noticed that when the user selects the actual "Close Window" button in the top right corner of the window, the program simply freezes. By highlighting execution on the Main VI, you can see that the program is still hung up on the custom dialog box Sub VI, which was just closed. There doesn't seem to be any way out of this besides clicking the "Abort" button on the Main VI. The issue can be replicated from the attached example files, which are the files given in the tutorial linked above.
Is there a way to handle the "Close Window" event in a way that doesn't freeze the program? For example, I believe LabVIEW's built-in dialog boxes (such as the Two-Button Dialog) are made so that the "Close Window" button performs the same function as the "Cancel" button. Is there a way to do that with a custom dialog box?
Thank you!
Solved! Go to Solution.
08-30-2023 12:48 PM
You have to filter the "close panel" event:
The you can throw out that event and make a true Boolean and hook it to the loop terminator.
08-30-2023 12:53 PM
Oftentimes with a dialog I will disable the [x] button to force the user to make a choice.
08-30-2023 01:20 PM
@billko wrote:
Oftentimes with a dialog I will disable the [x] button to force the user to make a choice.
For dialogs, I will treat the "Panel Close" event as a "Cancel" and react accordingly, including possibly throwing an error.
08-30-2023 01:25 PM
@crossrulz wrote:
@billko wrote:
Oftentimes with a dialog I will disable the [x] button to force the user to make a choice.
For dialogs, I will treat the "Panel Close" event as a "Cancel" and react accordingly, including possibly throwing an error.
That is a good way as well..