LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ask for save after data change AND next state button

Solved!
Go to solution

Hello,

I use an event driven state machine. In this state machine I have various states. Each state has it own tab in a tab control. Now I want to ask the user if he has already saved the new data if the "data changed on the front panel" AND "pushed the next state button".
I heard about dynamic event registering. I thought I could take a reference of all input objects and register these events. And I added an event case with all these elements its value change. In this event case I wanted to only show a message where I ask the user if he has already saved his data. If no I let him stay on the current UI where a save button is present. If he says yes, I would let him pass to the next state. (Compare ask for.png)
I added you also png with the dynamic event registering of nearly all elements which are input on the UI (I stopped ordering and wiring all up, because I think it was not the right way and rather ask you).

Is there a better way? And how I program "data changed on the front panel" AND "pushed the next state button" ?

Thanks for your help!!!

Best regards,

Soleil20

Download All
0 Kudos
Message 1 of 5
(2,489 Views)

Hi Soleil,

 

Is there a better way?

Why do you need to ask the user if (s)he has already saved the data?

Why doesn't your program track that information on its own?

 

1. You can recognize (using the event structure) when the user changes any (relevant) value.

2. You can recognize (using the event structure) when the user saves the data using any method your program offers.

Combine 1 and 2 to only ask for saving in case the user didn't do it on its own. (It's the very same scheme as LabVIEW uses to show the "*" dirt mark when you change a VI!)

 

I added you also png

Comments on them:

- we cannot debug images with LabVIEW (you heard that before!)

- there is a classic RubeGoldberg in the "ask" image:

IF true THEN true ELSE false

- why don't you clean up your block diagrams? (hidden wires, right-to-left wiring, …)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,484 Views)

Comments on them:

- we cannot debug images with LabVIEW (you heard that before!) If there is no implemented running structure I cannot give you a VI to debug. 🙂

- there is a classic RubeGoldberg in the "ask" image:   I said that this was the wrong way and I would do it not like that. This was only to show you what I mean.

 

- why don't you clean up your block diagrams? (hidden wires, right-to-left wiring, …) I think you mean in the ask.png that you can't see what goes in the blue wire and the error wire and where does it go? --> I used snipping tool to focus on the main part. Left wires come from shift registers which get the new values from the right wires.
And the dynamic.png --> I said that I didn't reordered it now because I think it is the wrong way. And it would be waisted time if it was completely wrong.


1. You can recognize (using the event structure) when the user changes any (relevant) value. --> one event case with every value change of every element?

2. You can recognize (using the event structure) when the user saves the data using any method your program offers. I have saving methods which get executed clicking the saving buttons. And this is traceable? How?


Thanks for your ideas!



0 Kudos
Message 3 of 5
(2,479 Views)
Solution
Accepted by topic author Soleil20

Hi Soleil,

 

1. You can recognize (using the event structure) when the user changes any (relevant) value. --> one event case with every value change of every element?

For instance…

Whenever the user changes a (relevant) value you set a flag (marking "dirty").

 

2. You can recognize (using the event structure) when the user saves the data using any method your program offers. I have saving methods which get executed clicking the saving buttons. And this is traceable? How?

When saving you can reset the "dirty" flag".

Now when the user wants to exit and the "dirty" flag is set you can ask to save the data (or save automatically)…

 

One more idea:

For a testbench I implemented a routine to handle different configurations (channel settings, etc.). The user can save and load those configurations by their name. There is one "special" configuration named "Standard": it gets saved automatically as the "last used configuration" and is also loaded automatically when the testbench software starts…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 5
(2,467 Views)

Hi GerdW,

 

it took me some time, but now I got it working like I want with your suggestions.

When I press a save button I change the value of the shift register to TRUE and in an event case for the certain value change I set it to FALSE. With that I can easily compare it with FALSE and activate there a dialog box for asking the user if he wants that the new data get saved. If he says yes, I activate the certain save button signalising.

 

Your idea is nice. I have implemented yet a variation of yours with only loading this settings at the start. But I will add now the saving sequence.

Best regards,

Soleil20

0 Kudos
Message 5 of 5
(2,445 Views)