LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

advanced control property

Solved!
Go to solution

Hello!

 

I would like to add a function in a control like the following:

 

In case that a user of a vi trying to change the value of a control I want a warning to be appeared prompt the user to confirm that he really wants to change the value of the control. What is really important to note is that I want my vi keep running with the control remain at its initial value until the user confirm the change of the value. Only when and if the user confirms the change I want the control value to be updated. Does anyone could make a suggestion?

 

Thank you in advance

0 Kudos
Message 1 of 6
(1,328 Views)

 

Like this?

 

event check.png

 

EDIT: Depending how the rest of your code is set up, you will find that the new value could be used before the user accepts it. You could however use one control on the front panel (which is check in the event) and a separate one that is changed and used only if the user accepts the change. Like so:

 

event catch 2.png

0 Kudos
Message 2 of 6
(1,320 Views)

Hello Ian,

 

Thank you for your suggestion. First of all I have to clarify that I was talking about a numeric control, sorry for not specifing earlier. However, correct me if I am wrong or if I haven't realized something but adopting your sugegstion in my case the vi remains stucked until the user makes his selection. For example, connecting the numeric control with a chart, you can see that the chart is not updated after the messages appearance and until the user make his selection.

 

Thank you 

0 Kudos
Message 3 of 6
(1,305 Views)
Solution
Accepted by topic author LW42

That is correct. The dialog box that appears is a modal dialog box, and it's a blocking dialog box. If you have something that must continuously update then you need a parallel loop in which you place the code to update the front panel. You could also create your own dialog box and launch it dynamically using the VI server. I think the parallel loop is probably an easier thing to do in your case. There are lots of examples that ship with LabVIEW on parallel loops. You should also spend some time looking at some of the Application Design Patterns.

 

If you have not already done so, you should spend some time to go through the introduction material, tutorial(s), and other material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.

0 Kudos
Message 4 of 6
(1,295 Views)

Yes - apologies for the poorly thought out dialog example. I was really just using that as an example of a way of checking that the data is correct. It could be replaced with range checks, other user checks etc.

 

I have implemented similar functions but I prefer to just create my own dialog box out of a sub vi with a couple of buttons. This allows greater control over the appearance but with the same (or more) functionality without blocking other code- e.g.

 

dialog.PNG

 

As for string or numeric controls - it really doesn't matter. Again, I just used strings as an example, but the value change event should still work for your needs (provided you pay attention to smercurio's points about learning about design architectures)

 

Ian

 

 

 

0 Kudos
Message 5 of 6
(1,288 Views)

Thank you all for suggestions. I will do my best.

 

Best regards

0 Kudos
Message 6 of 6
(1,275 Views)