LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create an event driven dialog box that allows the user to input constants into my program?

My goal is to have a box pop up when the executable for my program is run. The box will have a bunch of fields, and an OK and Cancel button. Ideally, the user will be made to change some of the values, and warnings (with another dialogue box) will pop up if the values are nonsensical, allowing the user to proceed or go back and change them. The constants will be clustered, to be used later in other VIs.

Does anyone have a good template for this sort of VI? I looked at this article: http://www.ni.com/tutorial/8768/en/, but it doesn't go into enough detail to be helpful to me.

0 Kudos
Message 1 of 6
(3,757 Views)

Just create a sub-vi with a custom view (so it looks like the pop-up box you want) that runs during the initialization steps of your main program.

 

The sub-vi can have it's own routines to check the values entered.

0 Kudos
Message 2 of 6
(3,740 Views)

Thanks for the response! How would I go about doing that? I've created a VI and set the window options to make it look like a dialog box. Past that, I'm not sure how best to set up the event structure. Do I do all my bounds checking when OK is pressed? How do I allow the user to go back and make changes, programmatically? Would I have event structures inside the event structure? Do I pass things out of the event structure to a normal indicator? This thing is presumably going to be in a while loop, so does the "stop" latch boolean come from the OK event?

 

0 Kudos
Message 3 of 6
(3,721 Views)

This should get you started down the pathJust replace User data with your cluster and do the data integrity check in the value change event use a simple one button dialog to notify the user which values are out of compliance and disable and grey the OK button untill all conditions are met.

A Resource Module.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 6
(3,718 Views)

What about the case where they don't change a value, and it's not in range? An example would be that a default weight is 0kg, which I'd want them to change. Also, I like your idea to disable and grey out the OK button, I'll definitely be using that. Is it possible to have another button that the user could click to "show errors" (which would pop up a window wist a list of errors) found in their inputs, so they could go back and know what to fix? Pardon my noobiness, thanks for the help!

 

edit: about that "show errors" button, I'd like to be able to create some sort of array of errors that gets added to in each event that finds one, and gets called from the "show errors" event as a new VI, which would just be another dialog (one button) that shows the array of errors. How would I do that? Would I need to use global variables to pass the array between events, or is there a better way?

0 Kudos
Message 5 of 6
(3,709 Views)
You don't need a separate button. You are already validating inputs to test whether or not to enable the "OK" button. Just extend that logic to automatically highlight incorrect values in some way, like changing the color of the label or something.

For some more ideas, check here.
http://www.notatamelion.com/2014/12/02/adding-a-non-blocking-dialog-box/

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 6
(3,650 Views)